V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
proxytoworld
V2EX  ›  问与答

apache 没办法获取请求的域名

  •  
  •   proxytoworld · 2021-02-02 11:06:33 +08:00 · 412 次点击
    这是一个创建于 1333 天前的主题,其中的信息可能已经有所发展或是发生改变。

    apache 监听 127.0.0.1:8080 用 nginx 监听 0.0.0.0:80 反向代理到 127.0.0.1:8080,apache 获取请求的域名是 127.0.0.1:8080 没办法获取 nginx 代理的域名,这怎么办,业务需要 apache 获取域名,因为要弄子域名根据子域名进行处理

    2 条回复    2021-02-04 11:38:42 +08:00
    learningman
        1
    learningman  
       2021-02-02 11:29:15 +08:00 via Android
    X-Forward-For 头部
    或者你 nginx 反代的时候 proxy_hostname(好像是这个)
    julyclyde
        2
    julyclyde  
       2021-02-04 11:38:42 +08:00
    proxy_set_header
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2513 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 21ms · UTC 13:21 · PVG 21:21 · LAX 06:21 · JFK 09:21
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.