#CORS Policy setup for Django Rest Framework on a mobile app

4 messages · Page 1 of 1 (latest)

sterile lily
#

Hey folks,
I have an issue, I was working on a django rest API and which was previously consumed on a web page, so it was easy for me to setup the CORS. But for some days we have a mobile app and I'm a little bit thinking of how to make this secure.

Am I to still use CORS, if yes, what is the mobile app IP address, if no, what am I to use for that purpose.

Note: CORS_ALLOW_ALL_ORIGINS = True is not an option, this makes the app vulnerable. Or is there another way to secure it...?
I ventured into customizing the App headers but yet it is somehow not working as well.

Lastly, I will be glad to know if the technology of the app influences the CORS policies as well.

wet sphinx
sterile lily
wet sphinx
# sterile lily I don't think this works for my usecase. I'm working with a mobile app.

may AI answer help:

For mobile apps, CORS may not be as relevant because mobile apps typically make requests directly to the API server without the same-origin restrictions imposed by web browsers.
However, if your mobile app includes web views or uses technologies like Ionic or React Native that rely on web technologies, CORS may still come into play.