MagicStack / MagicStack/httptools

PROXY protocol v1 / v2 support

Offen
#61 0 Kommentare 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Python
Sterne
1.3k
Forks
107
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Behind a reverse-proxy or a load balancer, you often need to get the original client IP.
A lot of load balancer provide these information with the PROXY protocol - HAproxy for exemple.
I have a load balancer that provide only this method to get the client info, and I would not be the only one.

Here a doc of the protocol: http://www.haproxy.org/download/2.4/doc/proxy-protocol.txt

In a nutshell, it's one line added on top of the body, here for the v1 protocol:

    PROXY TCP4 192.168.0.1 192.168.0.11 56324 443\r\n
    GET / HTTP/1.1\r\n
    Host: 192.168.0.11\r\n
    \r\n

This protocol is implemented in Gunicorn, and can be activated with --proxy-protocol: https://docs.gunicorn.org/en/stable/settings.html#proxy-protocol

edit: A NodeJS parser: https://github.com/racker/node-proxy-protocol/blob/master/index.js

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Es werden keine Repository-Dateien oder Tests genannt. Beginne damit, die verlinkte Spezifikation des HAProxy PROXY protocol zu lesen und das Verhalten von Gunicorns --proxy-protocol zu vergleichen; als abgeschlossen sollte gelten, dass httptools die angeforderten Clientinformationen des PROXY protocol v1 und v2 vor der HTTP-Anfrage unterstützt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
networking
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.