Nginx to Caddy reverse_proxy arguments

1. Caddy version (caddy version):

v2.4.6

2. How I run Caddy:

a. System environment:

Oracle Linux 8 w/ systemctl

Paste full file contents here.
Make sure backticks stay on their own lines,
and the post looks nice in the preview pane.

d. My complete Caddyfile or JSON config:

vm0.carter.ninja/* {
    header * {
        X-Frame-Options "SAMEORIGIN"
    }
    reverse_proxy 127.0.0.1:7070
}
vm0.carter.ninja/code/* {
    uri strip_prefix /code
    reverse_proxy 127.0.0.1:8080
}

3. The problem I’m having:

I’m trying to find the Caddy equivalent of the Nginx proxy_set_header, proxy_http_version, proxy_buffer_size, proxy_buffers, and proxy_busy_buffers_size

I suggest writing your config like this instead:

vm0.carter.ninja {
	handle_path /code/* {
		reverse_proxy 127.0.0.1:8080
	}

	handle {
		header X-Frame-Options "SAMEORIGIN"
		reverse_proxy 127.0.0.1:7070
	}
}

Are you sure you need those options? What leads you to believe you do? Caddy’s defaults typically work well for most usecases.

See the reverse_proxy docs:

1 Like

Thanks for the tip on how to write my config. The specific web server I am routing to gives a list of proxy headers and things of that sort that are optional but required for some features to be taken advantage of. I am having no problems at all with my code-server, but I am getting issues without those options on the root server.

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