Skip to content

Commit 8209b2e

Browse files
committed
Try to set up a Sentry-fronting endpoint
1 parent ca492a6 commit 8209b2e

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Caddyfile

+21
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,27 @@
2020
}
2121
}
2222

23+
{$ERRORS_DOMAIN:errors.httptoolkit.tech}:{$PORT:8080} {
24+
# This redirects Sentry requests from our own domain to their per-project subdomains:
25+
# from: https://errors.httptoolkit.tech/o123/api/456/...
26+
# to: https://o123.ingest.us.sentry.io/api/456/...
27+
@has_id_path {
28+
path_regexp id_path ^/o(\d+)(.*)$
29+
}
30+
31+
handle @has_id_path {
32+
reverse_proxy https://{re.id_path.1}.ingest.us.sentry.io {
33+
uri {re.id_path.2}
34+
35+
# Set appropriate headers
36+
header_up Host {upstream_hostport}
37+
38+
# Anonymize ip addresses when forwarding:
39+
header_up X-Forwarded-For "\.\d{0,3}(,\s*|$)" ".0$1"
40+
}
41+
}
42+
}
43+
2344
# For any other unrecognized services, we reject the request outright:
2445
:80, :443, :{$PORT:8080} {
2546
log

0 commit comments

Comments
 (0)