OPTIONS request failing when issued from CDN

shiz nginx-forum at forum.nginx.org
Sat Jun 30 18:54:19 UTC 2018

I could make it easily from localhost:

curl -i -X OPTIONS http://www.server.com/css/reset.css ->

xxx.xxx.xxx.190 - - [30/Jun/2018:11:33:53 -0700] "OPTIONS /css/reset.css
HTTP/1.1" 200 0 "-" "curl/7.38.0"
HTTP/1.1 200 OK
Server: nginx
Date: Sat, 30 Jun 2018 18:47:49 GMT
Content-Type: text/css
Content-Length: 0
Connection: keep-alive
Expect-CT: enforce; max-age=3600
Strict-Transport-Security: max-age=0

However when the CDN does it, it fails with 405.  I'd like to return a 200. 
Prefer not restricting the CDN on css/js/images at all.

I already have this in my config:

if ($request_method = OPTIONS ) { return 200; }

However the results are not what I expect:

``` - - [30/Jun/2018:11:27:31 -0700] "OPTIONS /css/reset.css
HTTP/1.1" 405 568
"Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 5 Build/JOP40D)
AppleWebKit/535.19 (KHTML, like Gecko; googleweblight) Chrome/38.0.1025.166
Mobile Safari/535.19"

I tried the `return 200` only today.  Prior to that, every solution proposed
in the internet resulted in all the css being unavailable.  No exception.

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,280352,280352#msg-280352

More information about the nginx mailing list