C是程序应用服务器,B是跳板机,https接口
C要请求https接口需要:C的请求到B由B到https接口
使用nginx可以实现吗?麻烦给个方案
nginx 配置反向代理
因为之前用的是http服务,这里需要将http服务转发到https,做个简单的配置,直接上图。
在之前的http服务配置中加上这句话就行了。
正常来说是没问题的,或者说很的情况下是可以通过nginx来实现的。
直接代理就可以
server {
listen 8000;
server_name localhost;
location / {
proxy_pass https://www.baidu.com;
}
}
这样通过nginx的http就可以访问到https的服务了
不过开发测试时可以这么做,上生产上最好不要使用这种方式。
可参见【http强制跳转https https://blog.csdn.net/qq_23995091/article/details/110941846#t5】
有两种方式:
方式1:使用nginx的301状态码
方式2:使用nginx的rewrite方法(Nginx的最早写法,目前还支持此方式)