NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
ge2009
V2EX  ›  NGINX

webservice 在 nginx 上 proxy 端口问题求解

  •  
  •   ge2009 · Dec 18, 2018 · 3340 views
    This topic created in 2727 days ago, the information mentioned may be changed or developed.

    有一个 SOAP 的 WebService 服务部署在 IIS 上,是基于.net 开发的,使用的端口是 8026, 然后使用 nginx 反向代理到外网,想使用 80 端口,配置如下:

      server {
            listen       80;
            server_name  tt.aaa.com;
            location / {
                proxy_pass http://10.11.21.123:8026;
                proxy_redirect off;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_set_header Host       $host;
            }
    

    访问都正常,但很奇怪的一点是,Visual Studio 引用这个地址的时候,就会将信息跳转到了"tt.aaa.com"的 8026 端口上,同时如果把远程调试打开,发现 Post 完信息后,都是跳转至 tt.aaa.com:8026 的端口了。我知道获取 host 地址可以使用$host,是否还有其他方式可以设置 port 的端口? 试过$port 也是一样的问题。

    有遇到这种问题的,还麻烦给一个思路,在此先谢过。

    1 replies    2018-12-18 16:40:46 +08:00
    redial39
        1
    redial39  
       Dec 18, 2018
    首先确定代码没写死 8026
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   908 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 19:54 · PVG 03:54 · LAX 12:54 · JFK 15:54
    ♥ Do have faith in what you're doing.