wnpllrzodiac
V2EX  ›  问与答

nginx/openresty 代理方案

  •  
  •   wnpllrzodiac · Jul 31, 2024 · 1236 views
    This topic created in 670 days ago, the information mentioned may be changed or developed.
    openresty 配置了端口 10000
    想实现某个目录的 location 代理到本机的其他端口上的服务,比如一个网盘的实现 端口 20000. 网盘会有一个主页,包括一下 js 资源文件等。直接在 LAN 访问 20000 端口的网页没有问题,包含一些 302 跳转等。
    但是如果配置想从 10000 端口加某个 location ,不知道怎么写 lua

    location /mydisk {
    proxy_pass 127.0.0.1:20000; // 这样显然是不行的,如果是 20000 端口是 api 接口,没问题。但是页面的话,涉及到 302 跳转和绝对路径的问题
    }

    比如 20000 端口会 / 自动跳转 到/login?param=xxxx
    还有一些 js 资源文件 20000 端口是写死的,没有给相对根路径的配置。比如 /js/xxx.js /css/yyy.css 请求不走/mydisk
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3268 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 14:06 · PVG 22:06 · LAX 07:06 · JFK 10:06
    ♥ Do have faith in what you're doing.