Nginx Module Reference manual: HTTP Referer module (HTTP Referer)

Source: Internet
Author: User
Keywords Http nginx referer referer Module
Tags aliyun blocked code compiled configure default html http

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.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.