and bound this middleware to multiple application instances running on my system. The middleware loads and shown in traefik web-UI. so far it works but I see redirect is always generated using http:// scheme even I access the initial URL though https://. My expectation this redirect would only replace the relevant part and preserve the scheme and hostname?
In my installation I do permenent http->https rewrite on the entrypoint level so the request works in general. But I'm wondering this is expected situation?
I even tried to hardcode the redirect to https:// but without success
still the "location:" is always http:// URL
(I removed not related curl output for better readability)
# curl test
curl https://test-nc.mydomain.tld/.well-known/carddav/ -ILv
* Trying 192.168.11.4:443...
* Connected to test-nc.mydomain.tld (192.168.11.4) port 443 (#0)
# initial request
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
< HTTP/2 301
HTTP/2 301
< location: http://test-nc.mydomain.tld/remote.php/dav/
location: http://test-nc.mydomain.tld/remote.php/dav/
# redirect to http:// using port 80
<
* Connection #0 to host test-nc.mydomain.tld left intact
* Clear auth, redirects to port from 443 to 80
* Issue another request to this URL: 'http://test-nc.mydomain.tld/remote.php/dav/'
* Switched from HTTP to HTTPS due to HSTS => https://test-nc.mydomain.tld/remote.php/dav/
in other words both tests below generate plain http://location: http://test-nc.mydomain.tld/remote.php/dav/ What is wrong and how can a generate valid https:// redirects?
I don't find anything related to the scheme in the service docs - only the scheme setting of the healthcheck - could you please point me to the right setting? I'm wondering how to setup this right.. I'm running the service as plain http and do TLS offloading using traefik. My service traefik labels are defined like this:
Can you explain again what you want to achieve? You use ReplacePathRegex (which changes the path inside the proxies/forwarded request), but also mention redirect.
when I access https://test-nc.mydomain.tld/.well-known/carddav/ I see 301 with location: http://test-nc.mydomain.tld but you might be right the redirect doesn't come from traefik.. at least it doesn't kick in for a simple whoami container (which I don't understand as well).. maybe the service behind created the redirect.
I'll do some more tests and come back with results..