mozilla-services / syncserver

Run-Your-Own Firefox Sync Server
Mozilla Public License 2.0
1.87k stars 145 forks source link

[docker-entrypoint.sh] Optionally handle X-Forwarded-Proto #132

Closed 1wilkens closed 6 years ago

1wilkens commented 6 years ago

In the default configuration gunicorn respects the X-Forwarded-Proto HTTP header only if the connection comes from localhost. This is not the case when e.g. running under docker where gunicorn sees the docker gateway IP causing it to disregard the header and potentially produce an error regarding the mismatch of public_url and application url. The commandline argument --forwarded-allow-ips tells gunicorn to trust the headers if the connection originates from certain other IP addresses. To expose this setting for docker setups of syncserver, the docker entrypoint is changed to optionally set this argument based on the environment variable SYNCSERVER_FORWARDED_ALLOW_IPS defaulting to 127.0.0.1 which mirrors the gunicorn default.

BirgerK commented 4 years ago

Please add this flag to documentation.

This helped to run my sync-server on a kubernetes-cluster.

Thanks. :)