[QUESTION] How would I add CORS header `Access-Control-Allow-Origin`?
See original GitHub issueIn developing a web frontend for busylight
, I would like to allow the development machine (running a self-hosted dev version of the web UI) to make requests to the server where the busylight
API is hosted.
Currently, browsers refuse to make those requests, claiming an Access-Control-Allow-Origin
header is missing.
Where would I add that header in busylight_api.py
? I don’t think adding the header to every single GET
endpoint is the right way – is there some general/middleware layer in which I can add headers to all responses?
I’m willing to make the change and submit a PR – just not too familiar with where in the API code to add things 😅
Issue Analytics
- State:
- Created a year ago
- Comments:18 (18 by maintainers)
Top Results From Across the Web
How does the 'Access-Control-Allow-Origin' header work?
Access -Control-Allow-Origin is a CORS (cross-origin resource sharing) header. When Site A tries to fetch content from Site B, Site B can send...
Read more >Cross-Origin Resource Sharing (CORS) - MDN Web Docs
The Cross-Origin Resource Sharing standard works by adding new HTTP headers that let servers describe which origins are permitted to read that ...
Read more >The Access-Control-Allow-Origin Header Explained
Access -Control-Allow-Origin is a CORS header. CORS, or Cross Origin Resource Sharing, is a mechanism for browsers to let a site running at ......
Read more >CORS and the Access-Control-Allow-Origin response header
The Access-Control-Allow-Origin header is included in the response from one website to a request originating from another website, and identifies the permitted ...
Read more >3 Ways to Fix the CORS Error — and How the Access- ...
How does this work? The proxy uses express middleware to apply a Access-Control-Allow-Origin: * header to every response from the server. At its ......
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 Free
Top 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
I manage dependencies and packaging with the tool poetry. You can
pip
install it for convenience:You can use plain python virtual environments using the
requirements.txt
in the root of the project, however that file is often out of date:I’ve updated the top-level README.md to include development installation instructions using poetry. That way its harder for me to forget how it works and mislead people who ask.