"X-forwarded-for" Web modification guest IP

Source: Internet
Author: User

X-forwarded-for (XFF) is an HTTP request header field that is used to identify the most original IP address of a client that is connected to a Web server through an HTTP proxy or load balancing method. The developer of the Squid cache proxy Server first introduced this HTTP header field and was formally presented by the IETF in the Forwarded-for HTTP header field normalization draft.
The general format of this HTTP header is as follows:

X-Forwarded-For: client1, proxy1, proxy2

Where the value is separated from multiple IP addresses by a comma + space, the leftmost (CLIENT1) is the IP address of the most original client, and the proxy server adds the requested source IP address to the right when each request is successfully received. In the above example, this request successfully passed through three proxy servers: Proxy1, Proxy2 and Proxy3.

Python:

Def setheader ():    RANDOMIP = str (random.randint (0, 255) + '. ' + str (random.randint (0, 255)) + '. ' + str (        Random.ra Ndint (0, 255)) + '. ' + str (random.randint (0, 255))    headers = {        ' user-agent ': Random.choice (UAS),        " Accept-language ":" zh-cn,zh;q=0.8,en;q=0.6 ",        ' x-forwarded-for ': Randomip,    }    return headers

  

"X-forwarded-for" Web modification guest IP

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.