nginx根据http请求头中的accept-language转发到不同的页面

直接上代码

if ($http_accept_language ~* ^zh){

                set $lang “/index_cn.jsp”;
}
if ($http_accept_language !~* ^zh){
               set $lang “/index_en.jsp”;

}

location =/  {

                proxy_set_header Host $host;
                proxy_set_header   X-Real-IP   $remote_addr;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_pass http://localhost:8080$lang;
}

© 版权声明
THE END
喜欢就支持一下吧
点赞5 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情

    暂无评论内容