- explain what you are trying to do,
Caddy + CORS setup
- show what you have already tried,
caddyfile cors snippet:
cors / {
origin https://api.mydomain
origin http://localhost
methods POST,PUT,GET,OPTIONS
allow_credentials true
max_age 1728000
allowed_headers Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range,Access-Control-Allow-Headers,Access-Control-Allow-Origin
exposed_headers Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range,Access-Control-Allow-Headers,Access-Control-Allow-Origin
}
- include error messages and log output,
for OPTIONS request, access-control-allow-origin has the right value but for POST request it has a duplicate value:
access-control-allow-origin = http://localhost, http://localhost
and I get the error message:
`
The ‘Access-Control-Allow-Origin’ header contains multiple values… but only one is allowed
`
Any idea about what’s going on here?
Thanks!