Monviech / os-caddy-plugin

Caddy Plugin with GUI for OPNsense
Other
38 stars 0 forks source link

Jinja2 template doesnt handle multiple subdomains with the same name but different port #41

Closed Monviech closed 9 months ago

Monviech commented 9 months ago

The handle for the subdomain has to contain the port in addition to the name so its unique.

# Reverse Proxy Domain: "41e45842-e3d7-4e3a-9aea-adf654cf6050"
*.example.com:443 {
        tls {
                dns cloudflare 1484053787dJQB8vP1q0yc5ZEBnH6JGS4d3mBmvIeMrnnxFi3WtJdF
        }

        @foo.example.com host foo.example.com:443
        handle @foo.example.com {
                handle {
                        reverse_proxy 192.168.1.1:443
                }
        }
        @foo.example.com host foo.example.com:8443
        handle @foo.example.com {
                handle /owa/* {
                        reverse_proxy 192.168.1.1:8443
                }
                handle {
                        reverse_proxy 192.168.1.1:8443
                }
        }
}
Monviech commented 9 months ago

Subdomains will be added with their uuids now:

# Reverse Proxy Domain: "41e45842-e3d7-4e3a-9aea-adf654cf6050"
*.example.com:443 {
        tls {
                dns cloudflare 1484053787dJQB8vP1q0yc5ZEBnH6JGS4d3mBmvIeMrnnxFi3WtJdF
        }

        @4c087454-ee7e-462d-a603-e58eee82a2b7 host foo.example.com
        handle @4c087454-ee7e-462d-a603-e58eee82a2b7 {
                handle /owa/* {
                        reverse_proxy 192.168.1.1:8443
                }
                handle {
                        reverse_proxy 192.168.1.1:443
                }
        }
        @409b7309-df6a-4ce0-aafd-bf7c21e64a7d host foo.example.com:8443
        handle @409b7309-df6a-4ce0-aafd-bf7c21e64a7d {
                handle /owa/* {
                        reverse_proxy 192.168.1.1:8443
                }
                handle {
                        reverse_proxy 192.168.1.1:8443
                }
        }
        @bee7f665-9ae1-499c-9a83-7c15862cc24f host foo.example.com:80
        handle @bee7f665-9ae1-499c-9a83-7c15862cc24f {
        }
}
Monviech commented 9 months ago

https://github.com/Monviech/os-caddy-plugin/pull/42