Skip to content

Commit b013c62

Browse files
authored
Add CORS headers to Webpack Dev Server to allow local serving of assets (#152)
This is for the development environment, so the webpack component can snarf anything from the main react UI app.
1 parent 5fc4940 commit b013c62

5 files changed

Lines changed: 1613 additions & 2 deletions

File tree

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ REACT_APP_AUTHENTICATION_CLIENT_ID='editor-dev'
22
REACT_APP_AUTHENTICATION_URL='http://localhost:9000'
33
REACT_APP_LOGIN_ENABLED='true'
44
REACT_APP_API_ENDPOINT='http://localhost:3009'
5-
REACT_APP_S3_BUCKET='https://editor-images-test.s3.eu-west-2.amazonaws.com'
5+
REACT_APP_S3_BUCKET='http://localhost:3000'

.env.webcomponent.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
REACT_APP_S3_BUCKET='https://editor-images-test.s3.eu-west-2.amazonaws.com'
1+
REACT_APP_S3_BUCKET='http://localhost:3000'

config/webpackDevServer.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ module.exports = function (proxy, allowedHost) {
9898
// See https://github.com/facebook/create-react-app/issues/387.
9999
disableDotRule: true,
100100
index: paths.publicUrlOrPath,
101+
},
102+
headers: {
103+
"Access-Control-Allow-Origin": "*",
104+
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS",
105+
"Access-Control-Allow-Headers": "X-Requested-With, content-type, Authorization"
101106
},
102107
public: allowedHost,
103108
// `proxy` is run between `before` and `after` `webpack-dev-server` hooks

public/sense_hat_blob.py

Lines changed: 1605 additions & 0 deletions
Large diffs are not rendered by default.

public/three

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../node_modules/three

0 commit comments

Comments
 (0)