# Proxy protocol

As already mentioned in [Listen](https://flying-fish.gitbook.io/flyingfish/index/configurations/listen), a stream forwarded by Nginx cannot include the source IP. We help ourselves by activating the proxy protocol. As a result, the packet is taken and the information from the original IP is stored at the beginning.

<figure><img src="https://1973811904-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Flk5l3lUfuUzRDnMDVwnw%2Fuploads%2FXsl499DuzzAdmSliI6bd%2Fproxy_protocol_without.png?alt=media&#x26;token=1baf9277-395d-4f69-9730-2bbd25b312ed" alt=""><figcaption></figcaption></figure>

As can be seen in the diagram, the stream still receives the original IP from the querying <mark style="background-color:blue;">client</mark>. As soon as the <mark style="background-color:yellow;">stream</mark> connects to the <mark style="background-color:green;">reverse proxy</mark>, this is an internal connection with 127.0.0.1. The information is lost from the reverse proxy for the <mark style="background-color:blue;">web server</mark>.

<figure><img src="https://1973811904-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Flk5l3lUfuUzRDnMDVwnw%2Fuploads%2FgPd17QYGr0OMvluS5LkP%2Fproxy_protocol_with.png?alt=media&#x26;token=f552433e-9fcd-4a0a-9597-cca795479a04" alt=""><figcaption></figcaption></figure>

With the <mark style="background-color:orange;">Proxy protocol</mark>, the <mark style="background-color:green;">reverse proxy</mark> receives the original IP with the package extension of the <mark style="background-color:orange;">Proxy protocol header</mark> and can pass it on to the <mark style="background-color:blue;">web server</mark>.

You can read more about it at [Exploring the proxy protocol](https://seriousben.com/posts/2020-02-exploring-the-proxy-protocol/).

<figure><img src="https://1973811904-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Flk5l3lUfuUzRDnMDVwnw%2Fuploads%2FTuevGvzdYrvT7T06hzA6%2Fproxy_protocol_meme.png?alt=media&#x26;token=a9aa58d0-c490-4b0f-afa4-6db9687904d6" alt=""><figcaption><p>Okay, a bit exaggerated ...</p></figcaption></figure>
