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

unable to allow specific CORS origin for api #357

Closed
DrWarpMan opened this issue Feb 15, 2024 · 4 comments · Fixed by #358
Closed

unable to allow specific CORS origin for api #357

DrWarpMan opened this issue Feb 15, 2024 · 4 comments · Fixed by #358
Labels
bug Something isn't working can reproduce This issue can be reproduced

Comments

@DrWarpMan
Copy link
Contributor

bug description

I believe setting cors=0 in the environment variables does not do anything.

Here we can see that when cors === '0', corsConfig is set to { origin: process.env.webURL, optionsSuccessStatus: 200 }.

Unfortunately, process.env.webURL will always be undefined, simply because apiMode is true only when process.env.webURL is undefined (see here).

@DrWarpMan DrWarpMan added the bug Something isn't working label Feb 15, 2024
@dumbmoron dumbmoron added the can reproduce This issue can be reproduced label Feb 15, 2024
@DrWarpMan
Copy link
Contributor Author

I see that there is already an open PR for a "fresh start", so you should take this issue into consideration if you intend to use the same logic to choose between running api/web mode.

@dumbmoron dumbmoron changed the title cors environment variable has zero effect unable to allow specific CORS origin for api Feb 15, 2024
@DrWarpMan
Copy link
Contributor Author

DrWarpMan commented Feb 15, 2024

Could you possibly take this into consideration as well?
https://developer.mozilla.org/en-US/docs/Web/Manifest#deploying_a_manifest

When using authentication in front of the cobalt frontend, I am unable to retrieve the manifest file cause of the CORS issue.

"If the manifest requires credentials to fetch, the crossorigin attribute must be set to use-credentials, even if the manifest file is in the same origin as the current page."

Adding crossorigin="use-credentials" attribute here would fix this problem, not sure if this is the right solution.

@wukko wukko linked a pull request Feb 16, 2024 that will close this issue
@wukko
Copy link
Member

wukko commented Feb 16, 2024

hey! i've updated the env variable to be CORS_URL (just like in wip 8.0)

make sure you're on 7.10.3 and try again, lmk if it works this time.
(i tested locally and it worked fine but i still would love feedback)

@DrWarpMan
Copy link
Contributor Author

Works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working can reproduce This issue can be reproduced
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants