I am trying to make a fetch request from a Shopify theme (JS) to an app hosted on PythonAnywhere but I get a 401 Authorization Required response on the Preflight request.
It works when I expose the same Django app through ngrok hosted on my local but it doesn't through pythonanywhere.
I'm using the django-cors-headers package for this with the following configurations in settings.py:
ALLOWED_HOSTS = [ '*' ]
CORS_ALLOWED_ORIGINS = [
'http://***.myshopify.com',
'https://***.myshopify.com'
]
CORS_ALLOW_ALL_ORIGINS = True
CORS_ALLOW_METHODS = [
'GET',
]
I am getting this response:
HTTP/1.1 401 Authorization Required
Date: Fri, 16 Sep 2022 14:50:01 GMT
Transfer-Encoding: chunked
Connection: keep-alive
WWW-Authenticate: Basic realm="Default Realm"
Server: PythonAnywhere
How can I get this to work under PythonAnywhere?