V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
JhOOOn
V2EX  ›  NGINX

nginx 搭配 django 自动登出 url

  •  
  •   JhOOOn · Dec 15, 2016 · 3590 views
    This topic created in 3430 days ago, the information mentioned may be changed or developed.

    现有一域名指向一台机器

    a.a.com -> 1.1.1.1
    

    在这个台机器配了一个 nginx ,用于访问该域名时可以指向另外一台机器的服务。

    #1.1.1.1
    server {
    	listen 8090;
       server_name localhost;
       location /bbb/ {
          proxy_pass 2.2.2.2:8000;
       }
    }
    

    在 2.2.2.2 的机器上有正常的 nginx 配置和 django 服务。

    当手动输入 a.a.com/bbb/ 时可以正常访问 django 服务, 可当 django 服务的 session 过期后,会自动跳转到 a.a.com:8090/bbb/。

    请问如何才能 自动登出 的时候回到**a.a.com/bbb/**这里。

    多谢。

    Supplement 1  ·  Dec 15, 2016
    8090 端口访问不通
    5 replies    2016-12-15 21:20:30 +08:00
    ss098
        1
    ss098  
       Dec 15, 2016
    JhOOOn
        2
    JhOOOn  
    OP
       Dec 15, 2016
    @ss098 谢谢, 我忘了说了, 8090 这个端口不可以被访问。。, 所以您提供的方法好像不可用。
    ss098
        3
    ss098  
       Dec 15, 2016   ❤️ 1
    http://khaozi.blog.51cto.com/952782/1857002

    如果跳转依赖的是 Location 或者 Refresh 头,那么这个命令就是可用的,可能我之前给你的方案还需要再根据情况改改。
    JhOOOn
        4
    JhOOOn  
    OP
       Dec 15, 2016
    @ss098 嗯,正在尝试, 多谢指点。
    JhOOOn
        5
    JhOOOn  
    OP
       Dec 15, 2016
    狂躁了一天, 发现 js 的跳转代码少加了一个反斜杠(前后端分离), 把 a.a.com/bbb 改为 a.a.com/bbb/就好了。。。。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3804 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 60ms · UTC 04:53 · PVG 12:53 · LAX 21:53 · JFK 00:53
    ♥ Do have faith in what you're doing.