Page MenuHomeElementl

[dagit] Avoid CORS in development

Authored by dish on Jul 9 2021, 5:28 PM.
Referenced Files
Unknown Object (File)
Sat, Jul 2, 4:47 AM
Unknown Object (File)
Thu, Jun 30, 1:08 AM
Unknown Object (File)
Tue, Jun 21, 4:12 PM
Unknown Object (File)
Wed, Jun 15, 4:20 PM
Unknown Object (File)
Mon, Jun 13, 7:29 PM
Unknown Object (File)
Mon, Jun 13, 1:18 PM
Unknown Object (File)
Mon, Jun 13, 12:04 AM
Unknown Object (File)
Sat, Jun 11, 2:48 AM



Make some changes to stop using CORS when developing Dagit.

  • Define an origin instead of a full GraphQL path for our env var. We can use this as a proxy for webpack configuration, which will let us avoid CORS.
  • Use the origin to build up the WebSocket URI.
  • Just use the GraphQL path in the HttpLink configuration, which lets us use the webpack proxy.

In general CORS isn't an immediate problem during development, but it's something we don't need at all if we can avoid it,and it causes problems if the backend has issues with preflight requests.

Test Plan

Run yarn build-for-python, load Dagit with this prod build. Verify that Dagit loads and requests are performed correctly. (Not using proxy.)

Run dev Dagit with the origin env var. Verify same as above, and verify that POST requests are not preceded by preflight requests. (Using proxy.)

Diff Detail

R1 dagster
Lint Not Applicable
Tests Not Applicable