Skip to content

DO NOT MERGE: Traefik reverse-proxy test for ProxyHeaders

Jaime Martinez requested to merge test-proxy-config-traefik into master

Related to #219 (closed)

Test to check that gorilla.ProxyHeaders work with a reverse-proxy like traefik in front of pages.

See test/proxy/docker-compose.yml for details on the traefik config

Results

Simple curl to ping either http or https, see response headers below

HTTP

❯ curl -H Host:root.docker.localhost http://127.0.0.1/hugo/ -i -sD - -o /dev/null
HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: max-age=600
Content-Length: 15931
Content-Type: text/html; charset=utf-8
Date: Mon, 17 Feb 2020 00:28:16 GMT
Expires: Mon, 17 Feb 2020 00:38:16 UTC
Last-Modified: Mon, 13 Jan 2020 05:36:06 GMT
Vary: Origin

# log line from pages
pages_1          | time="2020-02-17T00:28:16Z" level=info msg="request.IsHTTPS... scheme: 'http' ctxHTTPSKey: 'false'"

❯ curl -H Host:root.docker.localhost https://127.0.0.1/hugo/ -i -sD - -o /dev/null -k
HTTP/2 200
accept-ranges: bytes
cache-control: max-age=600
content-type: text/html; charset=utf-8
date: Mon, 17 Feb 2020 00:28:26 GMT
expires: Mon, 17 Feb 2020 00:38:26 UTC
last-modified: Mon, 13 Jan 2020 05:36:06 GMT
vary: Origin
content-length: 15931

# log line from pages
pages_1          | time="2020-02-17T00:28:26Z" level=info msg="request.IsHTTPS... scheme: 'https' ctxHTTPSKey: 'true'"

Added a log line in request.IsHTTPS and you can see the results for both tests

Screen_Shot_2020-02-17_at_11.28.55_am

Merge request reports