nginx代理后端服务返回404

nginx代理后端服务返回404

需带上host头

    location ^~ /publicApi/ {
        rewrite ^/publicApi/(.*)$ /public/v1/$1 break;
        proxy_pass http://public-api-backend:8231/;
        proxy_set_header  Host       $host;
        proxy_set_header  X-Real-IP    $remote_addr;
        proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;

    }
posted @ 2022-07-19 16:59  西门运维  阅读(1331)  评论(0编辑  收藏  举报