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

CORS is not set correctly for the API server #42

Open
doctorpangloss opened this issue Apr 25, 2024 · 2 comments
Open

CORS is not set correctly for the API server #42

doctorpangloss opened this issue Apr 25, 2024 · 2 comments
Assignees

Comments

@doctorpangloss
Copy link

doctorpangloss commented Apr 25, 2024

You must specify that the end user's Ingress should add the appropriate CORS headers, or you should propagate the configuration to the API server from values.yaml, to ensure that the frontend URL is correctly CORS-enabled.

For the Ingress corresponding to the API, these nginx location snippets address the issue

add_header 'Access-Control-Allow-Origin' 'https://frontendurl.yourdomain.com';
add_header 'Vary' 'Origin';
add_header 'Access-Control-Allow-Methods' 'GET, PUT, POST, DELETE, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization,apollographql-client-name,apollographql-client-version,x-lago-organization,customer-portal-token';

via apollographql/apollo-client#4164

@joaomirandas
Copy link

Thanks @doctorpangloss - but i made a small modifications in your suggestions,
For me running docker compose behind an NGINX inside a ubuntu linux instance i used:

proxy_set_header 'Access-Control-Allow-Origin' 'https://frontendurl.yourdomain.com,*';
proxy_set_header 'Vary' 'Origin';
proxy_set_header 'Access-Control-Allow-Methods' 'GET, PUT, POST, DELETE, OPTIONS';
proxy_set_header 'Access-Control-Allow-Headers' 'DNT,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization,apollographql-client-name,apollographql-client-version,x-lago-organization,customer-portal-token';

@jdenquin
Copy link
Contributor

Linked to getlago/lago#368

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

4 participants