Author: Ayou.1. Access to static content with question marks, for example, http: www.7jiejie.com? Abc, such a request will go directly to the backend server through squid cache and save the cache in squid, resulting in pressure and memory waste. Add filtering rules for html files and home pages to the nginx server to solve this problem. This rule determines the Home Page
Author: Ayou
1. Access to static content with question marks
Like http://www.7jiejie.com? Abc, such a request will pass through squIdCache directly to the backend server and save the cache in squid, resulting in pressure and memory waste.
Add filtering rules for html files and home pages to the nginx server to solve this problem. This rule judges the files ending with the home page and html, jpg, and gif. If there are? The error 403 is thrown, which is received by error_page and jumped to the correct address with 302.
LoCatIon ~ * (.Html $) | (^/$) | (.jpg $) | (.gif $ ){
Proxy_pass http://www.7jiejie.com;
If ($ is_args)
{
Return 403;
Error_page 403 = 200 $ scheme: // $ host $ uri;
}
}
This method is not perfect either. In the test, try to use the reWriteBut the original $ args is retained after rewrite? . In addition, if the url contains Chinese characters, the jump will fail, so make sure that the url does not contain Chinese characters, including url_eNcOde result.
2. Send a POST request to static content
Such requests also pass through squid, but do not cache content in squid.
Draw a Sequence Based on Huludao. The following configuration can be solved:
Location ~ * (.Html $) | (^/$) | (.jpg $) | (.gif $ ){
Proxy_pass http://www.7jiejie.com;
If ($ request_method = POST ){
Return 403;
Error_page 403 = 200 $ scheme: // $ host $ uri;
}
}