-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 allowed_origins not working as expected #1615
Comments
Yes, that's how CORS works: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS Without Unless I misunderstood what your issue is, I'm closing this. If I indeed misunderstood you, feel free to comment and I'll reopen promptly. |
I'm not sure if hydra is working properly because if I specify allowed_origins as http://* I would expect that with Origin:http://127.0.0.1:4200 headers the CORS are working fine but this didn't happen. |
Okay, I think I misundestood what you said! So it appears that |
Correct! |
Got it, thanks! Triaging as bug/client. What I don't really understand is, we actually have a test case covering your bug report: Lines 92 to 100 in 95a51de
Lines 92 to 100 in 95a51de
The only test case I couldn't find and taht would co-incide with your report would be where both the global config and the client config are using a wildcard. Alternatively, it could be cause you're using Lines 119 to 125 in 95a51de
Would you be open to checking this out and submitting a PR or info with your findings? |
…st protocol specified (for example "http://*") could use glob ** pattern in order to match any sequence of characters (even the separator). Signed-off-by: Aterocana <dominicimaurizio<at>gmail.com>
Hello, I'm proposing this solution: Aterocana@5d7cf58 with this pull request |
Ohh, yes, that makes a ton of sense! |
After many retries I found that Origin header is requested to get correct CORS headers.
In one of this retry in my configuration file I've specified allowed_origins as http://* and I've created a client with allowed_cors_origins: ["http://*"]. When I call (from postman) ./well-known/jwks.json url specifying Origin: http://127.0.0.1:4200, CORS headers are missing, but when I specified Origin: http://* it worked.
Reproducing the bug
I've tried with 1.0.2 version and 1.0.8 version but the bug is still present. See attached configuration.
Server configuration
cors:
enabled: true
allowed_origins:
- http://*
allowed_methods:
- POST
- GET
- PUT
- PATCH
- DELETE
allowed_headers:
- Authorization
- Content-Type
Environment
Additional context
For get it working I've to specify allowed_origins: http://localhost:4200 in server configuration and "allowed_cors_origins": ["http://127.0.0.1:4200"] into the client.
The text was updated successfully, but these errors were encountered: