Do a lookup to find reverse proxy
`forwarded_allow_ips` doesn't support CIDR
This commit is contained in:
parent
dc02e989e1
commit
79f532b5c0
1 changed files with 7 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
||||||
import os
|
import socket
|
||||||
|
|
||||||
import gunicorn
|
import gunicorn
|
||||||
|
|
||||||
|
@ -16,6 +16,9 @@ threads = 2
|
||||||
# Replace gunicorn's 'Server' HTTP header
|
# Replace gunicorn's 'Server' HTTP header
|
||||||
gunicorn.SERVER_SOFTWARE = gunicorn.SERVER = "Wouldn't you like to know"
|
gunicorn.SERVER_SOFTWARE = gunicorn.SERVER = "Wouldn't you like to know"
|
||||||
|
|
||||||
# Allow `X-Forwarded-*` headers from specific IPs
|
# HACK: Allow traefik to send forwarded IPs
|
||||||
if "FORWARDED_ALLOW_IPS" in os.environ:
|
# CIDR isn't supported here sadly
|
||||||
forwarded_allow_ips = os.environ["FORWARDED_ALLOW_IPS"]
|
try:
|
||||||
|
forwarded_allow_ips = socket.gethostbyname("traefik")
|
||||||
|
except socket.gaierror:
|
||||||
|
pass
|
||||||
|
|
Loading…
Reference in a new issue