Skip to main content

A simple WSGI app that returns the value of the `X-Forwarded-For` header

Project description

WSGIEchoIP

$ curl -L ip.jb2170.com
12.34.56.78

A simple WSGI app that returns the value of the X-Forwarded-For header, so one can get their public IP address.

No more need for $ curl -L -D - ipconfig.org and its unnecessary cookies!

Installing

I run this as a reverse proxy via Apache. Example systemd unit files and friends are in daemon-files of this repo

  • create a venv, say in ~/.local/var/lib/WSGIEchoIP, and source it
  • $ pip install WSGIEchoIP gunicorn
  • place the systemd unit file and shell script into the correct folders, for example I use ~/.local/var/lib/systemd/{etc/user,usr/bin}
  • place the .htaccess file in the public http folder corresponding to the domain you want to serve the app from
  • adjust the unix socket path in the .htaccess file and .service unit

Make sure you have the headers, proxy, and proxy_http modules enabled for Apache!

You can probably figure out the rest, enabling / starting the systemd service...

Customizing

Setting the environment variable FORWARDED_IP_HEADER_NAME=X-Sneed-Chuck makes the app return the X-Sneed-Chuck header value instead. (perhaps nginx uses something different than X-Forwarded-For.)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wsgiechoip-1.1.0.tar.gz (39.3 kB view details)

Uploaded Source

Built Distribution

WSGIEchoIP-1.1.0-py3-none-any.whl (27.3 kB view details)

Uploaded Python 3

File details

Details for the file wsgiechoip-1.1.0.tar.gz.

File metadata

  • Download URL: wsgiechoip-1.1.0.tar.gz
  • Upload date:
  • Size: 39.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for wsgiechoip-1.1.0.tar.gz
Algorithm Hash digest
SHA256 4b92c71f30805eb2f3fc2a3795eec72c59c53c1785433a63522d25dee1423538
MD5 02213a8e0e36e4a4301f400c80676f36
BLAKE2b-256 ed14615f395841b20a61ce2db04034cffb03daf216727ce64a98edc7a5e52679

See more details on using hashes here.

File details

Details for the file WSGIEchoIP-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: WSGIEchoIP-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 27.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for WSGIEchoIP-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2551d4b07e11e5e67d98cb5fece114d82ec395e110631aa7e2c1c8c151466a4b
MD5 e0b7df2e7ceed2bc38e17e14b7e5d839
BLAKE2b-256 d5cdd2e78204d189bb5423b18e0c3696fa97987877e0136a31f24313cf2e5286

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page