NAJI
NAJI

Reputation: 1

Invalid Host header when I visit my website with my own domain

everyone! I have one problem with React project. I developed one React Project and hosted on the AWS Lightsail server. I set Port of React as 80.

My site is working well with IP address, You can check my website with this url: http://54.80.46.251/

But it is not working with the domain. you can check my website with this url: https://peezee.org/

This is Package.json file of project

{
  "name": "my-app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@reduxjs/toolkit": "^1.8.0",
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.5.0",
    "@testing-library/user-event": "^7.2.1",
    "axios": "^0.26.1",
    "bootstrap": "^5.1.3",
    "ngrok": "^4.3.1",
    "node-sass": "^7.0.1",
    "react": "^17.0.2",
    "react-bootstrap": "^2.2.0",
    "react-dom": "^17.0.2",
    "react-redux": "^7.2.6",
    "react-router-dom": "^6.2.2",
    "react-scripts": "5.0.0",
    "redux-devtools-extension": "^2.13.9"
  },
  "scripts": {
    "start": "set PORT=80 && react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "source-map-loader": "^3.0.1",
    "webpack": "^5.70.0",
    "webpack-cli": "^4.9.2",
    "webpack-dev-server": "^4.7.4"
  },
  "proxy": "http://54.80.46.251:5000/"
}

If you know this problem solution, Please help me. Thanks.

Upvotes: 0

Views: 7383

Answers (2)

NAJI
NAJI

Reputation: 1

I solved this issue with below link https://create-react-app.dev/docs/proxying-api-requests-in-development/ Thanks

Upvotes: 0

Onoh Light
Onoh Light

Reputation: 11

I solved this issue on my dev environment by adding DANGEROUSLY_DISABLE_HOST_CHECK=true to the .env file.

You might want to check this GitHub issue out. https://github.com/gitpod-io/gitpod/issues/628

Upvotes: 1

Related Questions