Skip to content

Commit e278ff7

Browse files
authored
Fixed dev gateway forcing X-Forwarded-Proto https on ActivityPub routes (#29076)
no ref The preferred dev workflow for ActivityPub is still to use a tunnel to expose a public-facing URL (e.g. with Tailscale funnel), so that federation to/from external servers (e.g. mastodon) can be tested locally. This change allows devs to run AP without a tunnel (without federation), easing some setup.
1 parent 29ebce9 commit e278ff7

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

docker/dev-gateway/Caddyfile

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
{
22
admin off
3+
4+
# Everything reaching this gateway comes from loopback or the docker
5+
# bridge, so trust it as a proxy hop. This makes Caddy pass through
6+
# X-Forwarded-Proto from https tunnel agents (tailscale funnel / ngrok)
7+
# instead of overwriting it with the plain-http scheme it sees on :80.
8+
servers {
9+
trusted_proxies static private_ranges
10+
}
311
}
412

513
:80 {
@@ -50,11 +58,16 @@
5058

5159
# ActivityPub API - proxy activityPub requests to activityPub service (running in separate project)
5260
# Requires activitypub containers to be running via the ActivityPub project's docker-compose
61+
#
62+
# Unlike the Ghost blocks below, the ActivityPub blocks must NOT force
63+
# X-Forwarded-Proto: the AP service derives its own URLs (and whether to
64+
# fetch Ghost's JWKS over http or https) from the real scheme. Direct
65+
# localhost access needs http; tunneled access gets https passed through
66+
# from the tunnel agent via trusted_proxies (see global options).
5367
handle /.ghost/activitypub/* {
5468
reverse_proxy {env.ACTIVITYPUB_PROXY_TARGET} {
5569
header_up Host {host}
5670
header_up X-Real-IP {remote_host}
57-
header_up X-Forwarded-Proto https
5871
}
5972
}
6073

@@ -63,7 +76,6 @@
6376
reverse_proxy {env.ACTIVITYPUB_PROXY_TARGET} {
6477
header_up Host {host}
6578
header_up X-Real-IP {remote_host}
66-
header_up X-Forwarded-Proto https
6779
}
6880
}
6981

@@ -72,7 +84,6 @@
7284
reverse_proxy {env.ACTIVITYPUB_PROXY_TARGET} {
7385
header_up Host {host}
7486
header_up X-Real-IP {remote_host}
75-
header_up X-Forwarded-Proto https
7687
}
7788
}
7889

0 commit comments

Comments
 (0)