Nginx proxy_pass到Angular应用程序

时间:2018-09-06 20:34:35

标签: angular nginx proxy request-headers

我正尝试将Angular应用程序的所有请求的标头添加到外部API。过去,我是通过使用proxy_set_header并将proxy_pass指向正在运行的应用程序来完成此操作的。

我的配置如下。如您所见,我的Angular应用程序是一个静态文件。

location / {
    root /usr/share/nginx/html;
    index index.html index.htm;
    try_files $uri $uri/ /index.html =404;

    if ($http_x_forwarded_proto != https) {
        rewrite ^(.*) https://$host$1;
    }
}

有什么方法可以proxy_pass到静态应用程序?

0 个答案:

没有答案