Tutorial for using caddy with docker and custom headers?

Hi. I’m trying to run the “tracks” todo list app as a docker container on Ubuntu 16.04 with TLS (letsencrypt). Before I switched to Ubuntu I used OpenBSD, the “tracks” app without docker and relayd for letsencrypt. The “tracks” app can only do http, but if you set the X-Forwarded-Proto header in the requests to “https” it will understand that you are actually accessing it over https and will change all links in the outgoing html from http to https.

So what I want to do is this:

  • Use caddy with the “tracks” docker container and letsencrypt
  • On each request, add this header: X-Forwarded-Proto https

How would I go about doing that? I’m quite new to the backend world so I’m looking for a more detailed explanation that doesn’t assume too much prior knowledge. Any help would be greatly appreciated.

The Caddy proxy directive has a specification for the transparent preset, which will set a number of X-Forwarded headers correctly for this purpose (including X-Forwarded-Proto). You could include the preset or simply copy out the relevant upstream header.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.