Nginx $http_destination 变量含义

使用Nginx作为反向代理服务器, 后端是Apche服务器, 所有到nginx的请求均是https协议, 再由nginx的proxy_pass指令指向到Apche服务, 这时使用http协议. 具体配置如下:

location / {

    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    
    set $fixed_destination $http_destination;
    if ( $http_destination ~* ^https(.*)$ ) {
        set $fixed_destination http$1;
    }
    proxy_set_header Destination $fixed_destination;
    proxy_pass http://192.168.1.2:8000;
}

小弟十分不理解 $http_destination 这个变量的含义, 我试图将该变量内容输出到日志,但什么也没有打印出来,请哪位大神不吝赐教, 感激不尽.

阅读 3.6k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题