Skip to content

Improve local development CORS handling #172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/code-studio/.env.development
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
REACT_APP_ENABLE_LOG_PROXY=false
REACT_APP_CORE_API_URL=http://localhost:10000/jsapi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can take this one out too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried before leaving it in. It won't proxy ws:// so this has to stay.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to this thread it's a Chrome only issue: facebook/create-react-app#5280

But we can also fix it by having a src/setupProxy.js file, and adding the ws: true option. facebook/create-react-app#5280 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like an easier workaround until that issue is resolved. How about I just drop that ticket number next to it as a comment?

REACT_APP_NOTEBOOKS_URL=http://localhost:10000/notebooks
REACT_APP_LAYOUTS_URL=http://localhost:10000/layouts

# Proxy set in package.json to handle CORS for other URLs
# https://create-react-app.dev/docs/proxying-api-requests-in-development/

REACT_APP_ROUTER_BASE_NAME=/
REACT_APP_INTERNAL_PLUGINS=ExamplePlugin
PORT=4000
Expand Down
3 changes: 2 additions & 1 deletion packages/code-studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,6 @@
],
"publishConfig": {
"access": "public"
}
},
"proxy": "http://localhost:10000"
}