Skip to content

Commit 01d7741

Browse files
authored
fix(nginx): _assets should rewrite to _static/sentry/dist (#3483)
Our default fallback, `_assets`, assumes we use a CDN which is not the case on self-hosted. This patch adds a stop-gap fix for front-end URLs asking for this path. Should fix #3479 and #3470.
1 parent 245f3d1 commit 01d7741

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

_integration-test/test_run.py

+8
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ def test_initial_redirect():
8080
assert initial_auth_redirect.url == f"{SENTRY_TEST_HOST}/auth/login/sentry/"
8181

8282

83+
def test_asset_internal_rewrite():
84+
"""Tests whether we correctly map `/_assets/*` to `/_static/dist/sentry` as
85+
we don't have a CDN setup in self-hosted."""
86+
response = httpx.get(f"{SENTRY_TEST_HOST}/_assets/entrypoints/app.js")
87+
assert response.status_code == 200
88+
assert response.headers["Content-Type"] == "text/javascript"
89+
90+
8391
def test_login(client_login):
8492
client, login_response = client_login
8593
parser = BeautifulSoup(login_response.text, "html.parser")

nginx.conf

+4
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ http {
9898
location / {
9999
proxy_pass http://sentry;
100100
}
101+
location /_assets/ {
102+
proxy_pass http://sentry/_static/dist/sentry/;
103+
proxy_hide_header Content-Disposition;
104+
}
101105
location /_static/ {
102106
proxy_pass http://sentry;
103107
proxy_hide_header Content-Disposition;

0 commit comments

Comments
 (0)