SOLVED: V2 (beta 12): Not redirecting to https in Firefox

1. My Caddy version (caddy -version):

Note: I believe the command in the above line should be ‘caddy version’ without the dash.

bill@Bill2:~$ /usr/local/bin/caddy version
v2.0.0-beta12 h1:LZnXOGDr1SbeJNyln8Xc/hXjWCa/a9qFpCbWt2iwJPw=

2. How I run Caddy:

Please provide all of the relevant information and DO NOT REDACT anything except passwords/keys. Thank you!

a. System environment:

OS, relevant versions, systemd? docker? etc.

bill@Bill2:~$ lsb_release -a
LSB Version:    core-9.20170808ubuntu1-noarch:security-9.20170808ubuntu1-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 18.10
Release:        18.10
Codename:       cosmic
bill@Bill2:~$ systemctl --version
systemd 239

b. Command:

bill@Bill2:~$ which caddy
bill@Bill2:~$ systemctl start caddy.service
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to start 'caddy.service'.
Authenticating as: Bill,,, (bill)

c. Service/unit/compose file:

bill@Bill2:~$ cat /etc/systemd/system/caddy.service
Description=Caddy for Glucose

ExecStart=/usr/local/bin/caddy run



d. My complete Caddyfile:

bill@Bill2:~$ cat /usr/local/caddy/Caddyfile

matcher notStatic {
    not {
                file {
                        try_files {/home/bill/www}

reverse_proxy match:notStatic localhost:7000
file_server browse {
    root </home/bill/www>

3. The problem I’m having:

When I type into Chrome, or Edge, the url is automatically ‘flipped over’ to as expected and everything works great. But when I type into Firefox (Version 71.0), the browser just spins and eventually times out. If I type into Firefox manually, that works. So I must be missing some sort of information to make the automatic redirect work with Firefox. There is some mention in another topic here about needing to send something back to the browser. Something like this:

redir 301 {
  if {scheme} is http
  / https://{host}{uri}

Just exactly where would I put this? Thanks ever so much.

4. Error messages and/or full log output:

The browser (Firefox) times out with a page that says: “The connection has timed out”

5. What I already tried:

I tried to use the caddy.service file that comes with the Caddy installation. But I think I am stabbing around in the dark.

6. Links to relevant resources:

Putting a manual redirection block in won’t help if Firefox, for some reason, isn’t even connecting to Caddy at all. That needs to be troubleshooted in Firefox itself - or maybe in DNS? - and not in Caddy configuration, if it’s working in other browsers.

Can run a quick test - execute curl -IL from the command line and post the output?

1 Like

Here is the result of the curl test. It appears to show a good redirection. I will try and troubleshoot the timeout problem in Firefox.

bill@Bill2:~$ curl -IL
HTTP/1.1 308 Permanent Redirect
Connection: close
Server: Caddy
Date: Mon, 06 Jan 2020 23:09:46 GMT

HTTP/2 200
content-type: text/html; charset=utf-8
date: Mon, 06 Jan 2020 23:09:46 GMT
server: Caddy
server: gunicorn/20.0.4
content-length: 4614


Looking into why I don’t get an automatic redirect when trying to go to in Firefox (version 71.0). I see that after a lengthy timeout the address box shows So Caddy did redirect to https. But I do not yet understand where port 2015 is coming from, I will continue to explore.

Tried with Firefox Private Window, or clearing all site data?

Might be some kind of cached redirect.

1 Like

Thanks to your excellent advice the problem has been solved. I first tried going to in a Firefox Private Window and the https redirection worked like a charm. So that led to your next idea of clearing all site data. I did that and sure enough now redirects properly in a regular Firefox Window.

Everything is fine now. Thank you so much for your help.


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