部署到支持多容器的 Azure Web 应用程序时,我收到来自https://mysite.azurewebsites.com的“无效主机标头”消息
这运行良好。
我有两个 Docker 容器:client一个 React 应用程序和server一个托管我的 API 的 Express 应用程序。我正在使用代理将我的 API 托管在server.
在client's package.json 我已经定义:
"proxy": "http://localhost:3001"
Run Code Online (Sandbox Code Playgroud)
我使用以下 docker compose 文件在本地构建。
version: '2.1'
services:
server:
build: ./server
expose:
- ${APP_SERVER_PORT}
environment:
API_HOST: ${API_HOST}
APP_SERVER_PORT: ${APP_SERVER_PORT}
ports:
- ${APP_SERVER_PORT}:${APP_SERVER_PORT}
volumes:
- ./server/src:/app/project-server/src
command: npm start
client:
build: ./client
environment:
- REACT_APP_PORT=${REACT_APP_PORT}
expose:
- ${REACT_APP_PORT}
ports:
- ${REACT_APP_PORT}:${REACT_APP_PORT}
volumes:
- ./client/src:/app/project-client/src
- ./client/public:/app/project-client/public
links: …Run Code Online (Sandbox Code Playgroud)