wandenberg / nginx-push-stream-module

A pure stream http push technology for your Nginx setup. Comet made easy and really scalable.
Other
2.22k stars 295 forks source link

Request header field Content-Type is not allowed by Access-Control-Allow-Headers #153

Closed iotch closed 10 years ago

iotch commented 10 years ago

Hello. I'm trying to publish message to a channel from browser with xhr. As far as I understand, Content-Type header is set automatically by the browser even when I'm not setting it at all, so in Safari 5.1.7 I'm getting error:

Request header field Content-Type is not allowed by Access-Control-Allow-Headers

Access-Control-Allow-Headers sent by the module now are following:

If-Modified-Since,If-None-Match,Etag,Event-Id,Event-Type,Last-Event-Id

Is it possible to add Content-Type to allowed headers or is there any other solution? Thanks.

wandenberg commented 10 years ago

Hi @iotch

Your stream server and your html are in the same domain and port? If you use the same host and port this shouldn't be a problem. In the next version of push stream this default header will be removed to give the applications more control on that. For now, you can use the same host and port, or add an add_header directive in your config to force the Access-Control-Allow-Headers with the values If-Modified-Since,If-None-Match,Etag,Event-Id,Event-Type,Last-Event-Id,Content-Type

iotch commented 10 years ago

Hi @wandenberg

yes, I'm doing CORS request. Thanks, will add content type header myself. Thank you!