Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a CORS header to API calls #64

Open
grololo06 opened this issue Mar 11, 2023 · 1 comment
Open

Add a CORS header to API calls #64

grololo06 opened this issue Mar 11, 2023 · 1 comment
Assignees

Comments

@grololo06
Copy link
Member

We have the problem with EcoTaxoGuide that the front-end app (using Angular) refuses to connect to the API because it does not provide a correct CORS (https://developer.mozilla.org/fr/docs/Web/HTTP/CORS/Errors/CORSMissingAllowOrigin).

E.g.: https://ecotaxa.obs-vlfr.fr/api/object/25557188

Hacked today a "solution" in nginx, but the proper fix should be in the back-end: https://fastapi.tiangolo.com/tutorial/cors/

@grololo06 grololo06 self-assigned this Mar 11, 2023
@grololo06
Copy link
Member Author

grololo06 commented Mar 11, 2023


        location /api/object/  {
                proxy_pass http://localhost:8000;
                add_header 'Access-Control-Allow-Origin' '*' always;
        }
        location /api/vault/  {
                proxy_pass http://localhost:8000;
                add_header 'Access-Control-Allow-Origin' '*' always;
        }


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant