Skip to content

Python based docker container that automatically redirects requests from a domain to a specified target URL

Notifications You must be signed in to change notification settings

jono85/python-http-redirect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

python-http-redirect

Python based docker container that automatically redirects any requests to a configured target URL. All types of HTTP methods are supported, and request path does not make a difference - only checking for the requested URL's server domain name.

Configuration

Configuration is done through environmental variables, details in the table below

Enviro variable example/default comment
TZ Europe/Dublin Timezone configuration for the container (optional for logging)
THREADS_COUNT 2 amount of threads for Gunicorn server. Default set to 2, should be enough given the little work the server does.
REQUEST_TIMEOUT 30 request timeout after which the Gunicorn server will respond with an error to the request. Likely will never happen.
SERVER_PORT 80 TCP port the container will be listening on
USE_SELF_SIGNED_SSL false change to 'true' if you want the server to listen for HTTPS using a self signed cert that will be generated upon boot.
REAL_IP_HEADER_NAME not-set if the value is different from default 'not-set', the server will look for that header to read the original source IP of a request (this is for reverse-proxy scenarios, i.e. behind nginx reverse proxy with 'X-Real-Ip')
DEFAULT_REDIRECT https://www.google.com/ Any requests to a domain that's not configured will be redirected here.
REDIRECT_CONFIG { "some.domain.com": "https://redirected.address.com/" } a single json string containing Key:Value pairs - Key is the domain of the request, Value is the URL the request will be redirected to.

About

Python based docker container that automatically redirects requests from a domain to a specified target URL

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published