opnsense / plugins

OPNsense plugin collection
https://opnsense.org/
BSD 2-Clause "Simplified" License
849 stars 644 forks source link

www/caddy: Add redir directive to HTTP Handler #4263

Closed Monviech closed 2 months ago

Monviech commented 2 months ago

Fixes: https://github.com/opnsense/plugins/issues/4221

Allows for a configuration like this:

# Reverse Proxy Domain: "f33de7bf-83d9-48f9-988d-5804429420e5"
nextcloud.example.com {
    handle /.well-known/carddav {
        redir https://nextcloud.example.com/remote.php/dav/
    }

    handle /.well-known/caldav {
        redir https://nextcloud.example.com/remote.php/dav/
    }

    handle {
        reverse_proxy 192.168.1.10:11000 {
            header_down +Strict-Transport-Security "max-age=31536000;"
        }
    }
}

Needs testing, draft for now.

Monviech commented 2 months ago

Tested it, works for me. Least changes to the code necessary to add this. I'll take it. :)