Hello Ory community :wave: I'm wondering what I'm...
# talk-hydra
g
Hello Ory community 👋 I'm wondering what I'm doing wrong when configuring the CORS for the public URLs. My config looks something like in my local docker-compose.yaml:
Copy code
- SERVE_PUBLIC_CORS_ENABLED=true
      - SERVE_PUBLIC_CORS_DEBUG=true
      - SERVE_PUBLIC_CORS_ALLOWED_ORIGINS=<https://www.allowed.com>
      - SERVE_PUBLIC_CORS_ALLOWED_METHODS=POST
      - SERVE_PUBLIC_CORS_ALLOW_CREDENTIALS=false
But then when I run
Copy code
curl --location --request OPTIONS 'localhost:4444/oauth2/token' \
--header 'Origin: <https://www.hacker.com>' \
--header 'Access-Control-Request-Method: GET'
I get in my return headers:
Copy code
Access-Control-Allow-Methods: GET
Access-Control-Allow-Origin: <https://www.hacker.com>
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Date: ...
Which should not be allowed origins nor methods 😞 What am I misunderstanding or doing wrong? 🙂 🙏
It seems that on the preflight requests, all methods and origins are accepted, if the settings are specified. However, I expect them to be set correctly and forbid cross origin calls on the "real" call (not the OPTIONS one).