How to set caddy not to automatically configure ssl?

1. Caddy version (caddy version):

v2.2.1

2. How I run Caddy:

a. System environment:

Debian

d. My complete Caddyfile or JSON config:

http://domain.com {
 tls noreply@domain.com
 reverse_proxy 127.0.0.1:3000 {
  header_up Host {http.request.host}
  header_up X-Real-IP {http.request.remote}
  header_up X-Forwarded-For {http.request.remote}
  header_up X-Forwarded-Port {http.request.port}
  header_up X-Forwarded-Proto {http.request.scheme}
 }
}

3. The problem I’m having:

I want to visit the website domain.com without ssl, but it can’t be visited, and I try to remove the http, just leave like this

domain.com {
 tls noreply@domain.com
 reverse_proxy 127.0.0.1:3000 {
  header_up Host {http.request.host}
  header_up X-Real-IP {http.request.remote}
  header_up X-Forwarded-For {http.request.remote}
  header_up X-Forwarded-Port {http.request.port}
  header_up X-Forwarded-Proto {http.request.scheme}
 }
}

it works and can be visited like https://domain.com, but I only want to use 80 port, how? Thanks a lot.

If you only want to use HTTP, then use http:// and remove the tls directive. Those are in conflict in your first config example.

Also, all those header_up lines are unnecessary. Caddy already intelligently sets the relevant headers appropriately:

Try this:

http://domain.com {
	reverse_proxy 127.0.0.1:3000
}
1 Like