Nginx Module Reference manual: Real IP module (real IP)

Source: Internet
Author: User
Keywords NGINX IP Module
Tags added address aliyun client compile default value html http

If you want to use these modules, you must specify the relevant compilation parameters at compile time.

This module allows you to modify the IP address of the client in the request header (such as X-real-ip and X-forwarded-for).
This is useful for some of the nginx that work on the seven-layer http://www.aliyun.com/zixun/aggregation/13996.html ">" "Load Balancer", requests from local IP, However, the proxy server adds the true IP of the client to the request header.
To use this module, you must specify the following compilation parameters at compile time:

--with-http_realip_module

Notice to use: You will create a list of trusted proxies (see below) and the first untrusted IP in the head will act as the client IP (refer to Apache mod_extract).
Sample configuration:

Set_real_ip_from 192.168.1.0/24;set_real_ip_from 192.168.2.1;real_ip_header X-real-ip;

Instructions

Set_real_ip_from

Syntax: Set_real_ip_from [The address| Cidr| " UNIX: "]
Default value: None
Working with fields: HTTP, server, location
This directive specifies the trusted proxy IP that will be forwarded with an exact replacement IP. UNIX sockets can be specified after 0.8.22

Real_ip_header

Syntax: Real_ip_header [x-real-ip| X-forwarded-for]
Default value: Real_ip_header X-real-ip
Working with fields: HTTP, server, location
Set which header you want to use to determine the replacement IP address.

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.