Просмотр исходного кода

fix(dev): Allow dockerized relay to connect to dev server (#44821)

The change to `devServer.allowedHost` made in
https://github.com/getsentry/sentry/pull/44625 caused Relay to fail
authentication in our dev setup:

```
relay   2023-02-16T15:42:01Z [relay_server::actors::upstream] INFO: registering with upstream (http://host.docker.internal:8000/)
relay   2023-02-16T15:42:01Z [relay_server::actors::upstream] ERROR: authentication encountered error: could not send request
relay     caused by: failed to parse JSON response
relay     caused by: expected value at line 1 column 1
```

because the dev server responded with the string `Invalid Host header`.

I'm not sure why webpack is even in the loop for API requests, but
adding the `.docker.internal` suffix to `allowedHosts` seems to fix the
problem.
Joris Bayer 2 лет назад
Родитель
Сommit
215a13e727
1 измененных файлов с 7 добавлено и 1 удалено
  1. 7 1
      webpack.config.ts

+ 7 - 1
webpack.config.ts

@@ -526,7 +526,13 @@ if (
       'Access-Control-Allow-Credentials': 'true',
     },
     // Cover the various environments we use (vercel, getsentry-dev, localhost)
-    allowedHosts: ['.sentry.dev', '.dev.getsentry.net', '.localhost', '127.0.0.1'],
+    allowedHosts: [
+      '.sentry.dev',
+      '.dev.getsentry.net',
+      '.localhost',
+      '127.0.0.1',
+      '.docker.internal',
+    ],
     static: {
       directory: './src/sentry/static/sentry',
       watch: true,