HomeElementl

[dagit] Avoid CORS in development

Description

[dagit] Avoid CORS in development

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.)

Reviewers: bengotow, dgibson, max, prha

Reviewed By: max

Differential Revision: https://dagster.phacility.com/D8805

Details

Provenance
dishAuthored on Jul 9 2021, 3:16 PM
Reviewer
max
Differential Revision
D8805: [dagit] Avoid CORS in development
Parents
R1:55e6ba85dc8c: Automation: versioned docs for 0.12.1
Branches
Unknown
Tags
Unknown