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

nginx: Include CORS configuration for custom BlueOS services #2196

Merged

Conversation

rafaellehmkuhl
Copy link
Member

@rafaellehmkuhl rafaellehmkuhl commented Nov 10, 2023

This patch allows external applications, like Cockpit, to use the service to store configuration data.

@CLAassistant
Copy link

CLAassistant commented Nov 10, 2023

CLA assistant check
All committers have signed the CLA.

@Williangalvani
Copy link
Member

have you tried going through /bag/ ? nginx should handle it

@rafaellehmkuhl
Copy link
Member Author

rafaellehmkuhl commented Nov 11, 2023

have you tried going through /bag/ ? nginx should handle it

Tried, yes. No success:

Access to fetch at 'http://192.168.0.12/bag/v1.0/get/cockpit' from origin 'http://localhost:5173' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

@rafaellehmkuhl
Copy link
Member Author

@Williangalvani @patrickelectric any suggestion on this one?

@Williangalvani
Copy link
Member

can you try adding both of these to the "server" block?
https://github.com/bluerobotics/BlueOS/blob/master/core/tools/nginx/nginx.conf#L132-L135

@Williangalvani
Copy link
Member

or maybe we just need proxy_hide_header on /bag

@rafaellehmkuhl
Copy link
Member Author

or maybe we just need proxy_hide_header on /bag

No luck.

I really think the server has to add CORS policy.
NGINX can do so much. In terms of delivering the content or not is up to the actual server (FastAPI/Starlette/Uvicorn).

@rafaellehmkuhl rafaellehmkuhl force-pushed the open-cors-bag-holding branch 3 times, most recently from 0d154c6 to a97a3c0 Compare November 14, 2023 20:27
@rafaellehmkuhl rafaellehmkuhl merged commit 3dc5828 into bluerobotics:master Nov 14, 2023
@rafaellehmkuhl rafaellehmkuhl deleted the open-cors-bag-holding branch November 14, 2023 21:15
@rafaellehmkuhl rafaellehmkuhl changed the title core: bag-of-holdings: Disable CORS policy nginx: Include CORS configuration for custom BlueOS services Nov 14, 2023
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

Successfully merging this pull request may close these issues.

3 participants