Page MenuHomeElementl

[dagit] Avoid CORS in development
ClosedPublic

Authored by dish on Jul 9 2021, 5:28 PM.

Details

Summary

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

Repository
R1 dagster
Branch
dish-graphql-path
Lint
Lint Passed
Unit
No Test Coverage