I managed to solve it using Istio. In case anyone using Istio and running into this problem, I used this VirtualService:
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: sentry-web
namespace: sentry
spec:
hosts:
- "mydomain"
gateways:
- 'my-gateway'
http:
- match:
- uri:
exact: /api/store/
route:
- destination:
port:
number: 3000
host: sentry-relay
- match:
- uri:
regex: .*/api/.*
route:
- destination:
port:
number: 3000
host: sentry-relay
- route:
- destination:
port:
number: 9000
host: sentry-web
This is a lazy translation of this: Event submission rejected by CSRF