Skip to content

Commit

Permalink
fix: invalid host header issue on codesandbox
Browse files Browse the repository at this point in the history
solves Issue #94 (The examples no longer work in CodeSandbox environments.)

We need to add the allowedhosts-flag to devServer-settings for webpack.config:

devServer-config to solve "Invalid Host header Issue" on CodeSandBox:

codesandbox/codesandbox-client#3392 and

https://stackoverflow.com/a/43647767 and
  https://codesandbox.io/docs/learn/repositories/task#configuring-task-ports

https://github.com/webpack/webpack-dev-server/blob/master/CHANGELOG.md#firewall

https://webpack.js.org/configuration/dev-server/#devserverallowedhosts

firewall: false, // failed while testing

disableHostCheck: true, // failed while testing

allowedHosts: This flag finally solved it
  • Loading branch information
Stefan.Brueck committed Oct 20, 2023
1 parent 817ac45 commit a9b09ee
Show file tree
Hide file tree
Showing 13 changed files with 1 addition and 49 deletions.
2 changes: 1 addition & 1 deletion .github/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

We are more than happy to accept external contributions to the project
in the form of feedback, bug reports and even better - pull requests :)
All our CodeSandBox-Samples are [synced-templates](https://codesandbox.io/docs/learn/sandboxes/synced-templates) with our GitHub-repo: they will update automatically, once our repositories main branch got updated.
All our CodeSandBox-Samples are [synced-templates](https://codesandbox.io/docs/learn/sandboxes/synced-templates) with our GitHub-repo: they will update automatically, once our repositories master branch got updated.

## How to contribute

Expand Down
4 changes: 0 additions & 4 deletions examples/find-components/.codesandbox/tasks.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
{
// These tasks will run in order when initializing your CodeSandbox project.
"setupTasks": [
{
"name": "Install Dependencies",
"command": "yarn install"
}
],

// These tasks can be run from CodeSandbox. Running one will open a log in the app.
"tasks": {
"start": {
"name": "start",
"command": "yarn start",
"runAtStart": true,
"preview": {
// Set 8080 as primary port for task start
"port": 8080
}
}
Expand Down
4 changes: 0 additions & 4 deletions examples/five-star/.codesandbox/tasks.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
{
// These tasks will run in order when initializing your CodeSandbox project.
"setupTasks": [
{
"name": "Install Dependencies",
"command": "yarn install"
}
],

// These tasks can be run from CodeSandbox. Running one will open a log in the app.
"tasks": {
"start": {
"name": "start",
"command": "yarn start",
"runAtStart": true,
"preview": {
// Set 8080 as primary port for task start
"port": 8080
}
}
Expand Down
4 changes: 0 additions & 4 deletions examples/get-component-by-dom-node/.codesandbox/tasks.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
{
// These tasks will run in order when initializing your CodeSandbox project.
"setupTasks": [
{
"name": "Install Dependencies",
"command": "yarn install"
}
],

// These tasks can be run from CodeSandbox. Running one will open a log in the app.
"tasks": {
"start": {
"name": "start",
"command": "yarn start",
"runAtStart": true,
"preview": {
// Set 8080 as primary port for task start
"port": 8080
}
}
Expand Down
4 changes: 0 additions & 4 deletions examples/gondel-react/.codesandbox/tasks.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
{
// These tasks will run in order when initializing your CodeSandbox project.
"setupTasks": [
{
"name": "Install Dependencies",
"command": "yarn install"
}
],

// These tasks can be run from CodeSandbox. Running one will open a log in the app.
"tasks": {
"start": {
"name": "start",
"command": "yarn start",
"runAtStart": true,
"preview": {
// Set 8080 as primary port for task start
"port": 8080
}
}
Expand Down
4 changes: 0 additions & 4 deletions examples/hello-world/.codesandbox/tasks.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
{
// These tasks will run in order when initializing your CodeSandbox project.
"setupTasks": [
{
"name": "Install Dependencies",
"command": "yarn install"
}
],

// These tasks can be run from CodeSandbox. Running one will open a log in the app.
"tasks": {
"start": {
"name": "start",
"command": "yarn start",
"runAtStart": true,
"preview": {
// Set 8080 as primary port for task start
"port": 8080
}
}
Expand Down
4 changes: 0 additions & 4 deletions examples/lazy-load/.codesandbox/tasks.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
{
// These tasks will run in order when initializing your CodeSandbox project.
"setupTasks": [
{
"name": "Install Dependencies",
"command": "yarn install"
}
],

// These tasks can be run from CodeSandbox. Running one will open a log in the app.
"tasks": {
"start": {
"name": "start",
"command": "yarn start",
"runAtStart": true,
"preview": {
// Set 8080 as primary port for task start
"port": 8080
}
}
Expand Down
4 changes: 0 additions & 4 deletions examples/plugin-data/.codesandbox/tasks.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
{
// These tasks will run in order when initializing your CodeSandbox project.
"setupTasks": [
{
"name": "Install Dependencies",
"command": "yarn install"
}
],

// These tasks can be run from CodeSandbox. Running one will open a log in the app.
"tasks": {
"start": {
"name": "start",
"command": "yarn start",
"runAtStart": true,
"preview": {
// Set 8080 as primary port for task start
"port": 8080
}
}
Expand Down
4 changes: 0 additions & 4 deletions examples/plugin-media-query/.codesandbox/tasks.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
{
// These tasks will run in order when initializing your CodeSandbox project.
"setupTasks": [
{
"name": "Install Dependencies",
"command": "yarn install"
}
],

// These tasks can be run from CodeSandbox. Running one will open a log in the app.
"tasks": {
"start": {
"name": "start",
"command": "yarn start",
"runAtStart": true,
"preview": {
// Set 8080 as primary port for task start
"port": 8080
}
}
Expand Down
4 changes: 0 additions & 4 deletions examples/plugin-resize/.codesandbox/tasks.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
{
// These tasks will run in order when initializing your CodeSandbox project.
"setupTasks": [
{
"name": "Install Dependencies",
"command": "yarn install"
}
],

// These tasks can be run from CodeSandbox. Running one will open a log in the app.
"tasks": {
"start": {
"name": "start",
"command": "yarn start",
"runAtStart": true,
"preview": {
// Set 8080 as primary port for task start
"port": 8080
}
}
Expand Down
4 changes: 0 additions & 4 deletions examples/react-gondel/.codesandbox/tasks.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
{
// These tasks will run in order when initializing your CodeSandbox project.
"setupTasks": [
{
"name": "Install Dependencies",
"command": "yarn install"
}
],

// These tasks can be run from CodeSandbox. Running one will open a log in the app.
"tasks": {
"start": {
"name": "start",
"command": "yarn start",
"runAtStart": true,
"preview": {
// Set 8080 as primary port for task start
"port": 8080
}
}
Expand Down
4 changes: 0 additions & 4 deletions examples/trigger-public-event/.codesandbox/tasks.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
{
// These tasks will run in order when initializing your CodeSandbox project.
"setupTasks": [
{
"name": "Install Dependencies",
"command": "yarn install"
}
],

// These tasks can be run from CodeSandbox. Running one will open a log in the app.
"tasks": {
"start": {
"name": "start",
"command": "yarn start",
"runAtStart": true,
"preview": {
// Set 8080 as primary port for task start
"port": 8080
}
}
Expand Down
4 changes: 0 additions & 4 deletions examples/typescript/.codesandbox/tasks.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
{
// These tasks will run in order when initializing your CodeSandbox project.
"setupTasks": [
{
"name": "Install Dependencies",
"command": "yarn install"
}
],

// These tasks can be run from CodeSandbox. Running one will open a log in the app.
"tasks": {
"start": {
"name": "start",
"command": "yarn start",
"runAtStart": true,
"preview": {
// Set 8080 as primary port for task start
"port": 8080
}
}
Expand Down

0 comments on commit a9b09ee

Please sign in to comment.