Opened 7 years ago
Closed 7 years ago
#1313 closed task (invalid)
If "return" rules are above than "expires", then "expires" stop working.
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | major | Milestone: | |
Component: | nginx-core | Version: | 1.10.x |
Keywords: | Cc: | pkg-nginx-maintainers@… | |
uname -a: | Linux NGX 4.9.0-3-686-pae #1 SMP Debian 4.9.30-2+deb9u2 (2017-06-26) i686 GNU/Linux | ||
nginx -V: |
nginx version: nginx/1.10.3
built with OpenSSL 1.1.0d 26 Jan 2017 (running with OpenSSL 1.1.0f 25 May 2017) TLS SNI support enabled Debian's latest packages.debian.org/stretch/nginx-extras |
Description
server{
...
[1] location ~* \.(css|js|jpg|zip)$ {valid_referers server_names;if ($invalid_referer){return 444;}}
[2] location ~ /customer/downloads/ {valid_referers server_names;if ($invalid_referer){return 444;}}
[3] location ~* \.(css|html|js|jpg)$ {expires 2h;}
...
}
Current result:
/customer/downloads/ (=index.html) --- returns "Cache-Control: max-age=7200" header
/customer/downloads/xxx.css,
/customer/downloads/xxx.jpg --- doesn't return Cache header
Expected result:
/customer/downloads/xxx.css,
/customer/downloads/xxx.jpg must return cache control header, like html.
Why is this happening?
Note:
Change History (2)
comment:1 by , 7 years ago
comment:2 by , 7 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Consider reading How nginx processes a request and documentation on the location directive. In the example above, /customer/downloads/xxx.jpg
request is matched by the location ~* \.(css|js|jpg|zip)$
location, which does not contain the expires
directives. As such, the result is expected.
If you have further questions on how to use nginx, consider support options available.
nginx processing
Expected result:
Actual result: