has been blocked by CORS policy: Request header field cache-control is not allowed by Access-Control-Allow-Headers in preflight response.
See original GitHub issuehas been blocked by CORS policy: Request header field cache-control is not allowed by Access-Control-Allow-Headers in preflight response.
settings.py
EVENTSTREAM_ALLOW_ORIGIN = "*"
EVENTSTREAM_ALLOW_CREDENTIALS = False
# this is for corsheaders (pip)
CORS_ORIGIN_ALLOW_ALL = True
is something wrong with the setitng? or its causing cors iissue cause it’s asgi? other api are worling file, just /event does not work…
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Request header field Access-Control-Allow-Headers is not ...
This is a request that uses the HTTP OPTIONS verb and includes several headers, one of which being Access-Control-Request-Headers listing the headers the...
Read more >Request header field content-type is not allowed by Access ...
My netlify function has these headers set up: const headers = { 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Headers': ...
Read more >Access-Control-Allow-Headers - HTTP - MDN Web Docs
This header is required if the request has an Access-Control-Request-Headers header. Note: CORS-safelisted request headers are always allowed ...
Read more >Resolve the "No 'Access-Control-Allow-Origin' header" error ...
If you still see errors after updating your CORS policy and forwarding the appropriate headers, allow the OPTIONS HTTP method in your distribution's...
Read more >CORS and the Access-Control-Allow-Origin response header
Under certain circumstances, when a cross-domain request includes a non-standard HTTP method or headers, the cross-origin request is preceded by a request using ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Here’s the solution: https://stackoverflow.com/questions/45118468/request-header-field-cache-control-is-not-allowed-by-access-control-allow-header
You probably need to add this to settings.py:
from corsheaders.defaults import default_headers
CORS_ALLOW_HEADERS = default_headers + ('cache-control',)
the last one is what you need, the rest I assume is default.
I need to set multiple headers for my preflight response Ex: username, userid, pagename etc. How can I achieve that? Because as far as I know the EVENTSTREAM_ALLOW_HEADERS only takes a single string.