我有一个用于在 nginx 上运行的角度应用程序的 docker 容器,名为“website”。我想从其他名为“test.nginx”的 nginx 反向代理容器访问此容器。但我不知道如何配置 nginx.conf 进行反向代理。
首先,我正在为 Angular 应用程序创建 docker 映像。Dockerfile:
FROM nginx:alpine
COPY default.conf /etc/nginx/conf.d/default.conf
COPY angular /usr/share/nginx/html
Run Code Online (Sandbox Code Playgroud)
这里的角度文件夹包含角度构建文件(index.html,main.js,runtime.js ...)
默认.conf:
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
Run Code Online (Sandbox Code Playgroud)
docker-compose.yml
version: '3.4'
services:
nginx:
image: nginx:latest
container_name: test.nginx
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
ports:
- 2020:80
environment:
- NETWORK_ACCESS=internal
website:
image: website
container_name: website
restart: on-failure
ports: …Run Code Online (Sandbox Code Playgroud) 我对ASP.Net Core 2.2和SignalR有问题。我在asp.net核心和Angular之间使用SignalR。当我使用Asp.net core 2.0时,一切正常。但是,当我将asp.net core 2.2与相同的代码一起使用时,相同的类会出现cors错误。
警告:CORS协议不允许同时指定通配符(任何)来源和凭据。如果需要支持凭据,请通过列出各个来源来配置策略。
我怎么解决这个问题?
谢谢