NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
awker
V2EX  ›  NGINX

openresty 如何使用 lua 实现 map 的这个功能?

  •  
  •   awker · Dec 12, 2019 · 4631 views
    This topic created in 2352 days ago, the information mentioned may be changed or developed.

    根据请求 cookie 设置不同的变量

    map $http_cookie $rootpath {
        "~gray" "/data/gray";
        default "/data";
    }
    server {
        listen 80;
        server_name devtest.foobar.cn;
        access_log logs/devtest_access.log  main;
        index index.html index.htm index.jsp index.do;
        root /data;
    
        location ~ /omg {
            root $rootpath;
            try_files $uri $uri/;
        }
    
    
    1 replies    2019-12-12 11:32:22 +08:00
    sanmaozhao
        1
    sanmaozhao  
       Dec 12, 2019
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5259 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 07:40 · PVG 15:40 · LAX 00:40 · JFK 03:40
    ♥ Do have faith in what you're doing.