宇筱博客

  • 解决办法
  • 学无止境
  • 记录时光
  • 百宝箱
宇筱博客
点滴记忆,汇聚成海。
  1. 首页
  2. 解决办法
  3. 正文

解决nginx反向代理https报400 Bad Request

2021年1月3日 4716点热度 0人点赞 0条评论

报错信息:

400 Bad Request

The plain HTTP request was sent to HTTPS port

报错原因:

用户使用HTTPS访问外网服务器,外网服务器通过Nginx反代,访问具体内网服务,但是内网无法提供HTTPS服务,所以发生了302重定向,就报错了

无标题.png

解决办法:

添加中转代码(proxy_redirect http:// $scheme://;),反代时使用http访问内网访问

示例代码:

location /xiaopengyounihao{
    proxy_pass http://127.0.3.13:6666/xiaopengyounihao;
    proxy_set_header Host $http_host;
    proxy_set_header X-Forward-For $remote_addr;
    proxy_redirect http:// $scheme://;
    }

标签: 暂无
最后更新:2021年1月3日

小渔民

这个人很懒,什么都没留下

点赞
< 上一篇
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

COPYRIGHT © 2025 宇筱博客. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

豫ICP备15017825号-2