V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
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 · 2018-12-18 16:37:30 +08:00 · 2457 次点击
    这是一个创建于 1927 天前的主题,其中的信息可能已经有所发展或是发生改变。

    有一个 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 条回复    2018-12-18 16:40:46 +08:00
    redial39
        1
    redial39  
       2018-12-18 16:40:46 +08:00
    首先确定代码没写死 8026
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1048 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 19:08 · PVG 03:08 · LAX 12:08 · JFK 15:08
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.