reactjs 当我使用自己的域访问我的网站时,主机标头无效

q3qa4bjr  于 2022-12-03  发布在  React
关注(0)|答案(2)|浏览(148)

大家好!2我有一个关于React项目的问题。3我开发了一个React项目,并在AWS Lightsail服务器上托管。4我将React端口设置为80。
我的网站是工作以及IP地址,你可以检查我的网站与此URL:http://54.80.46.251/
但它是不工作的域。你可以检查我的网站与此网址:https://peezee.org/
这是项目的Package.json文件

{
  "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/"
}

如果你知道这个问题的解决方案,请帮助我。谢谢。

jv2fixgn

jv2fixgn1#

我通过将DANGEROUSLY_DISABLE_HOST_CHECK=true添加到.env文件中,在我的开发环境中解决了这个问题。
您可能需要检查这个GitHub问题。https://github.com/gitpod-io/gitpod/issues/628

相关问题