Referer Header missing using Caddy with Sentry

This is a CORS error, it means that whatever client is connecting to your server isn’t sending the Referer header. It doesn’t mean that Caddy isn’t proxying it.

Caddy passes through all headers transparently by default, so it’s wrong to add a header_up line, since the original request didn’t have it in the first place.

Remove this, you only want this if you’re proxying to an HTTPS upstream, otherwise you’re overriding the Host with sentry-self-hosted-web-1 which isn’t right.

There’s no reason to do this, it doesn’t have any benefit. It doesn’t hide anything sensitive.

From this config, it looks like it proxies API requests to the relay instead of web.

		location ~ ^/api/[1-9]\d*/ {
			proxy_pass http://relay;
		}

You should probably try and do the same with Caddy. You can add this to your config:

@relay `path_regexp('^/api/[1-9]\d*') || path('/api/store/*')`
reverse_proxy @relay sentry-self-hosted-relay-1:3000

I’m guessing the relay doesn’t check for CORS so this might solve it.

If not, then you’ll need to get help from the Sentry community. I don’t know the recommended setup.

1 Like