These modules are all compiled into Nginx by default unless a module is manually specified to be excluded in configure.
When a request header's http://www.aliyun.com/zixun/aggregation/16918.html ">referer field contains some incorrect fields, this module can prevent this request from accessing the site."
This head is free to forge, so using this module does not prevent 100% of these requests, and most of the rejected requests come from some typical browsers, which can be considered a typical browser that does not provide a "Referer" header or even the right requests.
The following example:
location/photos/{valid_referers none blocked www.mydomain.com mydomain.com; if ($invalid _referer) {return 403;}}
Instructions
Valid_referers
Syntax: valid_referers [None|blocked|server_names] ...
Default value: No
Working with fields: server, location
This instruction assigns a value to the $invalid _referer variable based on the Referer header, with a value of 0 or 1.
You can use this command to implement the anti-theft chain function, if the Valid_referers list does not have the Referer header value, $invalid _referer will be set to 1 (reference precedent).
The parameters can be as follows:
None means nonexistent Referer head blocked means to camouflage Referer head according to firewall, such as: "Referer:xxxxxxx". Server_names is a list of one or more servers, and the "*" wildcard character can be used in the name after version 0.5.33.