Redir http to https reverse proxy?

1. Caddy version (caddy version):

v2.3.0 h1:fnrqJLa3G5vfxcxmOH/+kJOcunPLhSBnjgIvjXV/QTA=

2. How I run Caddy:

a. System environment:

Windows 10.0.19042 Build 19042

b. Command:

.\caddy_windows_amd64.exe run --config Caddyfile

c. Service/unit/compose file:

d. My complete Caddyfile or JSON config:

localhost:8443 {
        reverse_proxy localhost:8096

3. The problem I’m having:

I’m trying to make http://localhost:8443 redirect to https://localhost:8443, which is setup as a reverse proxy.

4. Error messages and/or full log output:

Client sent an HTTP request to an HTTPS server.

5. What I already tried:

I tried to set a redir before the reverse proxy setting, like this:

http://localhost:8443 {
redir https://localhost:8443

https://localhost:8443 {
	reverse_proxy localhost:8096


But then I get this message when trying to run caddy:

2021/01/07 15:38:51.176 INFO using provided configuration {“config_file”: “Caddyfile”, “config_adapter”: “”}
run: adapting config using caddyfile: server listening on [:8443] is configured for HTTP and cannot natively multiplex HTTP and HTTPS: https://localhost:8443

6. Links to relevant resources:

Hey jj, welcome –

You can’t serve two protocols on the same port without a multiplexer. I did write one for Caddy but you’ll have to plug it in and configure it with JSON.

Without a multiplexer, you can serve HTTP on one port, and HTTPS on another.

1 Like

Thanks, matt, I’ll look into it.

This topic was automatically closed after 30 days. New replies are no longer allowed.