small-packages/luci-mod-istorenext/README.md
2026-07-28 01:38:11 +08:00

21 lines
924 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## 自定义后端与luci共享session
### 主要流程:
```
1. nginx转发/cgi-bin/luci/istorenext/开头的请求到自定义后端
2. 如果自定义后端返回403则下一步。否则直接透传回到步骤1。
3. nginx渲染登录界面登录URL参数会加上istorenextlogin=1。用户登录时会用POST请求
4. 当nginx收到POST的请求且istorenextlogin=1就转发给luci
5. luci登录失败的话会返回403回到步骤3luci登录成功的话会原地重定向URL中还是有istorenextlogin=1但是变成GET请求到下一步
6. nginx收到GET请求且istorenextlogin=1就再次重定向到没有istorenextlogin=1的URL回到步骤1由于已经登录且cookie共享自定义后端就不会再返回403除非session过期了
```
### 示例
`./root-demo` 文件夹下包含一个自定义后端的 demo。demo判断登录则渲染200页面没登录就403。