Reserver Proxy Multi-Domain and Comm Static Files

1. Caddy version (caddy version):

v2.5.0-rc.1

2. How I run Caddy:

xcaddy build --with GitHub - caddy-dns/dnspod
–with github.com/lucas-clemente/quic-go@v0.25.0

a. System environment:

OS: Ubuntu 20.04 LTS
Golang: go1.18

b. Command:

./caddy run -watch

d. My complete Caddyfile or JSON config:

*.airdb.net {
	tls {
		#dns dnspod {env.DNSPOD_TOKEN}
		dns dnspod 307575,AAAAAAAAA
	}

	encode {
		#zstd
		gzip
	}

	@not_static {
		not {
			path /BingSiteAuth.xml /robots.txt
			path /favicon.ico
		}
	}

	#root /robots.txt /srv/www
	#file_server

	# https://caddyserver.com/docs/caddyfile/directives/reverse_proxy
	@service host dev.airdb.net
	reverse_proxy @service http://127.0.0.1:7000

	@serviceA host a.airdb.net
	reverse_proxy @serviceA http://127.0.0.1:8000

	@serviceB host b.airdb.net
	reverse_proxy @serviceB http://127.0.0.1:9000

	root * /srv/www
	file_server
}

3. The problem I’m having:

Using this Caddyfile can get wildcard certs successfully, and reserver_proxy by multi-domain.
The issue is:
Is there a way to set the static favicon or robots to use the same local file?

4. Error messages and/or full log output:

5. What I already tried:

6. Links to relevant resources:

Why are you replacing the version of quic-go?

You don’t have experimental_http3 in your config, so I don’t understand why you’d need this.

You could try this:

@static path /BingSiteAuth.xml /robots.txt /favicon.ico
handle @static {
	root * /srv/www
	file_server
}

handle {
	@service host dev.airdb.net
	reverse_proxy @service http://127.0.0.1:7000

	@serviceA host a.airdb.net
	reverse_proxy @serviceA http://127.0.0.1:8000

	@serviceB host b.airdb.net
	reverse_proxy @serviceB http://127.0.0.1:9000
}
1 Like

Thank you @Francis.
Let me have a try.

For quick-go, it is a temp solution for go version 1.18.

You don’t need that though. v2.5.0-rc.1 build on Go 1.18, since we fixed it in ci: Build on Go 1.18, bump actions versions (#4637) · caddyserver/caddy@4e9fbee · GitHub

Noted and removed it.

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