Beginners issues for reverse_proxy

1. The problem I’m having:

I am trying to reverse proxy a golang server (http not https) hosted on a windows server in my local network. I need to translate from dns subdomain ( to a go server that serves at the location, and will also have static assets like css, favicon, etc.
Ultimately, I want Caddy to be the terminator for TLS, accept tls and provide certificates to the WAN portion of my setup, but use just http inside my LAN, unless I need to enable it for a site I am proxying.
That’s an ultimate wish, but if I need to change configurations around my go app, then so be it.

2. Error messages and/or full log output:

Error: adapting config using caddyfile: Caddyfile:11: unrecognized directive: auto_https

3. Caddy version:

v2.7.4 h1:J8nisjdOxnYHXlorUKXY75Gr6iBfudfoGhrJ8t7/flI=

4. How I installed and ran Caddy:

Installed using sudo apt install caddy, and also debian-keyring debian-archive-keyring apt-transport-https

a. System environment:

This is a virtual machine of ubuntu

PRETTY_NAME="Ubuntu 22.04.3 LTS"
VERSION="22.04.3 LTS (Jammy Jellyfish)"

b. Command:

used caddy start as root from within a folder with my Caddyfile, and
have been making incremental changes and testing as I go using

root@webbby:/home/bjarvis/caddy# caddy reload
2023/08/29 15:11:53.903 INFO    using adjacent Caddyfile
Error: adapting config using caddyfile: Caddyfile:11: unrecognized directive: auto_https

c. Service/unit/compose file:

d. My complete Caddy config:

}, {
        root * /var/www/singing
} {
        auto_https off
        reverse_proxy /dadjoke
        reverse_proxy /static

5. Links to relevant resources:

This is a portion of my nginx configuration that seems to work “ok”

server {
   listen 443 ssl http2;

   access_log /var/log/nginx/ custom;
   error_log /var/log/nginx/ notice;

   include snippets/;
   include snippets/ssl-params.conf;

   location / {
        include snippets/proxy-params.conf;
   location /dadjoke {
        include snippets/proxy-params.conf;
   location /static {
        include snippets/proxy-params.conf;

auto_https is a global option, not a directive. You can’t use it there (it would go next to debug, in the global options block)

Why are you trying to turn this off? What’s the goal exactly? Are you trying to serve from HTTP only? If so, prepend http:// to your site address.

This matches /dadjoke, i.e. it expects the path to be exactly /dadjoke on the incoming request and will only proxy if that path matches exactly.

Are you looking to rewrite the request path instead? Then you’re looking for handle_path as a replacement for nginx’s location, or use the rewrite directive to add a path prefix before proxying.

1 Like

Hello, Francis -

Well, I want to have TLS / HTTPS from the internet to Caddy, but from Caddy to my backend server(s) have only HTTP. I believe that’s the way it is currently working in my nginx config.

I’ll look into handle_path and the rewrite directive.

Thank you for your response

That’s the default. Remove auto_https off then. That’s for controlling whether Caddy sets up HTTPS for incoming connections.

1 Like

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