OPNsense Forum

Archive => 24.1, 24.4 Legacy Series => Topic started by: mthird on April 19, 2024, 05:57:59 PM

Title: 24.1.6 Caddy Won't Start After Upgrade
Post by: mthird on April 19, 2024, 05:57:59 PM
I upgraded to 24.1.6 and the Caddy proxy won't start.  The issue is that AutoHTTPs wrote an unsupported option to the Caddfyfile.  Changing AutoHTTPs to anything other than "On" and then back again fixes the issue.

Error: adapting config using caddyfile: parsing caddyfile tokens for 'auto_https': auto_https must be one of 'off', 'disable_redirects', 'disable_certs', or 'ignore_loaded_certs', at /usr/local/etc/caddy/Caddyfile:16

# DO NOT EDIT THIS FILE -- OPNsense auto-generated file


# Global Options
{
        log {
                include http.log.access.3116a565-600b-4cd3-913b-f16a7ec416b4
                output net unixgram//var/caddy/var/run/log {
                }
                format json {
                        time_format rfc3339
                }
        }

        email nobody@example.com
        auto_https on
        import /usr/local/etc/caddy/caddy.d/*.global
}


After running the above, it now looks like:


# DO NOT EDIT THIS FILE -- OPNsense auto-generated file


# Global Options
{
        log {
                include http.log.access.3116a565-600b-4cd3-913b-f16a7ec416b4
                output net unixgram//var/caddy/var/run/log {
                }
                format json {
                        time_format rfc3339
                }
        }

        email nobody@example.com
        import /usr/local/etc/caddy/caddy.d/*.global
}
Title: Re: 24.1.6 Caddy Won't Start After Upgrade
Post by: Monviech (Cedrik) on April 19, 2024, 07:42:12 PM
Yeah that happened because I removed the option "on" in favor of an empty option. I tested it by pressing apply in the "General" settings one time, and then thought everything is fine, looks good.

I didn't expect that anybody would press "Apply" in the Reverse Proxy first, because there, the form of general doesn't get saved and the new empty setting applied.

So, it was an oversight of me, but the impact is low. Generally, the above mentioned fix is the best choice. Thanks for writing it.


(Edit: Good that I implemented these validation messages in the GUI, it makes these kind of errors very easy to find.  8) )

EDIT: https://github.com/opnsense/plugins/pull/3931
Title: Re: 24.1.6 Caddy Won't Start After Upgrade
Post by: mthird on April 22, 2024, 10:38:33 PM
Thank you for the great plugin!  I'm a developer by trade so I generally find the coolest way to break things.  Unintentionally.
Title: Re: 24.1.6 Caddy Won't Start After Upgrade
Post by: Monviech (Cedrik) on April 23, 2024, 08:10:42 AM
Thanks for the feedback, this will be hotfixed soon, I made a migration script that fixes this for all people in the future.

I always try not to break things, but sometimes there are side effects I didn't test xD
Title: Re: 24.1.6 Caddy Won't Start After Upgrade
Post by: franco on April 23, 2024, 10:19:47 AM
It was hotfixed yesterday, actually.


Cheers,
Franco