captncraig / cors

Cross Origin Resource Sharing middleware for go
MIT License
19 stars 19 forks source link

Duplicate access-control-allow-origin on GET request #4

Closed ianwalter closed 8 years ago

ianwalter commented 8 years ago

Trying to use the InfluxDB UI which is proxied by Caddy. The OPTIONS request looks fine, but on the subsequent GET request I get a CORS error because of the duplicate headers:

access-control-allow-origin:https://influx.mydomain.com
access-control-allow-origin:https://influx.mydomain.com

My Caddyfile looks like:

https://influx.mydomain.com {
  # tls ...
  # basicauth ...
  proxy / http://influxdb:8083/
}

https://influx.mydomain.com:8086 {
  # tls ...
  proxy / http://influxdb:8086/
  cors / {
    origin https://influx.mydomain.com
    allowed_headers Authorization
  }
}

Any ideas why this is happening?

ianwalter commented 8 years ago

It seems that InfluxDB may be writing theses headers and so adding cors is not necessary.

captncraig commented 8 years ago

I have a nearly identical setup for influx and don't need cors. I think influx just automatically does what you need.