Nginx Browser rewrite rules cause 404 errors in static files
-
Again, thanks for this great plugin!
The browser cache rules cause 404 errors in static files when using alias.
So, part of my config in /sites-available/ would be.
location /masters1/ { add_header Content-Disposition "attachment"; alias /masters1/; }
And these rewrite rules cause my server to throw 404 errors when I search for those files (www.example.com/masters1/myfile)
location ~ \.(css|htc|less|js|js2|js3|js4)$ { expires 31536000s; etag on; if_modified_since exact; add_header Pragma "public"; add_header Cache-Control "max-age=31536000, public"; add_header X-Powered-By "W3 Total Cache/0.9.7"; try_files $uri $uri/ $uri.html /index.php?$args; } location ~ \.(html|htm|rtf|rtx|svg|txt|xsd|xsl|xml)$ { expires 0s; etag off; if_modified_since exact; add_header Pragma "public"; add_header Cache-Control "max-age=0, public"; add_header X-Powered-By "W3 Total Cache/0.9.7"; try_files $uri $uri/ $uri.html /index.php?$args; } location ~ \.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|webp|json|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|_otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|_ttf|wav|wma|wri|woff|woff2|xla|xls|xlsx|xlt|xlw|zip)$ { expires 31536000s; etag on; if_modified_since exact; add_header Pragma "public"; add_header Cache-Control "max-age=31536000, public"; add_header X-Powered-By "W3 Total Cache/0.9.7"; try_files $uri $uri/ $uri.html /index.php?$args; } location ~ \.(bmp|class|doc|docx|eot|exe|ico|webp|json|mdb|mpp|otf|_otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|pot|pps|ppt|pptx|svg|svgz|swf|tif|tiff|ttf|ttc|_ttf|wav|wri|woff|woff2|xla|xls|xlsx|xlt|xlw)$ { etag off; if_modified_since off; try_files $uri $uri/ $uri.html /index.php?$args; }
Obviously, if I remove the file extensions that I use in my alias then it works, but I use both audio and image files and I want to get the browser cache for images.
Any ideas on how can I make this work?
Regards
The page I need help with: [log in to see the link]
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Nginx Browser rewrite rules cause 404 errors in static files’ is closed to new replies.