Sign inSign up

aaron465/redirecter

By aaron465

•Updated over 9 years ago

Simple Python aiohttp web redirecter

Image
0

623

aaron465/redirecter repository overview

⁠redirecter

redirecter is a very small and simple Python application written with aiohttp⁠ which redirects HTTP requests to another server of your choice, maintaining the path part of the request.

For example, if you configured the remote server to http://example.com, then a request to redirecter at http://localhost:8000/foo/bar?stuff=things would redirect to http://example.com/foo/bar?stuff=things.

⁠Running with Docker

The easiest way to run is with the pre-built Docker image⁠. The configuration is done via environment variables and should be self explanatory:

$ docker run --detach --publish 80:8000 --restart always --name redirecter \
    --env "REDIRECTER_TARGET=http://example.com" \
    --env "REDIRECTER_HOST=0.0.0.0" \
    --env "REDIRECTER_PORT=8000" \
    aaron465/redirecter:latest

Note: Do NOT include a trailing slash ('/') on the REDIRECTER_TARGET variable; this is not currently handled and will result in a double slash in the redirected URL.

⁠Running with Python

If you'd prefer to run with Python directly, rather than inside Docker, then this is for you:

Prerequisites:

  • Python 3.5+
$ pip install -r requirements.txt
$ REDIRECTER_TARGET="http://example.com" REDIRECTER_HOST="0.0.0.0" \
    REDIRECTER_PORT="8000" python redirecter.py

Tag summary

Content type

Image

Digest

Size

31 MB

Last updated

over 9 years ago

docker pull aaron465/redirecter