Skip to content

Instantly share code, notes, and snippets.

@sochi
Created June 2, 2020 16:16
Show Gist options
  • Save sochi/2538a57e2e46a3ccb49d79ca06befe50 to your computer and use it in GitHub Desktop.
Save sochi/2538a57e2e46a3ccb49d79ca06befe50 to your computer and use it in GitHub Desktop.
Configure Nette to use trust HTTP proxy when running in docker
# docker is apparently using the range of 172.16.0.0/12 for networking by default
#
# and Nette by default routes and redirects based on remote addresses in $_SERVER,
# which means that it redirects using the internal ports, e.g., 8080, which are in
# most cases different from mapped ports
#
# though Nette can be instructed to trust the forwarded values, using its http.proxy
# configuration, to use the forwarded values (in routing and redirects) the remote
# has to be specified as a trusted proxy
#
# however the remote IP can vary (unless configured differently) between service runs
# which makes any static configuration unreliable, luckily http.proxy supports CIDR
# notation thus a range of addresses can be specified
http:
proxy: 172.16.0.0/12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment