mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
Web browsers automatically issue an OPTIONS request in advance of other HTTP requests when the document's domain does not match the target in order to facilitate Cross-Origin Resource Sharing. These requests are forbidden from specifying a body and typically do not specify an (unecessary) `Length` header. Node.js automatically adds the `Content-Encoding: chunked` header value to requests that do not specify a `Length` header. This makes proxied OPTIONS requests from web browsers invalid. Explicitly set the `Content-Length` header of all `OPTIONS` requests to "0", disabling the default "chunked" encoding behavior [2]. [1] http://www.w3.org/TR/cors/ [2] http://nodejs.org/api/http.html