나는 그것을 사용하고 있다nginx그리고응록백업용 아키텍처는 다음과 같습니다.
internet <---> ngrok <---> nginx <---> my app
^ ^
+-------------------------+
문제는 https를 사용하여 ngrok에 요청할 때 https
프로토타입이 전달되지 않는다는 것입니다.
http.Header{
"Connection": {"close"},
"Cache-Control": {"max-age=0"},
"Accept": {"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"},
"Accept-Encoding": {"gzip, deflate, sdch"},
"Cookie": {"SK=YI4oj_BbbmGGK6WqgS8VZT63EiiZDJop3T4k7Lsyz2JX173c8"},
"X-Forwarded-Proto": {"http"},
"Http-Client-Ip": {"127.0.0.1"},
"User-Agent": {"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.125 Safari/537.36"},
"Accept-Language": {"en-US,en;q=0.8,id;q=0.6"},
"X-Forwarded-For": {"127.0.0.1"},
"X-Forwarded": {"127.0.0.1"},
"X-Real-Ip": {"118.97.79.125"},
}
직접 접속 시 https
표시되는 내용 :
http.Header{
"Connection": {"close"},
"Accept": {"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"},
"Accept-Encoding": {"gzip, deflate, sdch"},
"Cookie": {"PHPSESSID=vjouh02c-fzytF59w5RPPFE98Xie6yFGe3MKFsc2MTTdMSJC6PRbik-dBolT6YU0ndycBV769CHhJXJipb1"},
"X-Forwarded-Proto": {"https"},
"Http-Client-Ip": {"172.16.10.2"},
"Accept-Language": {"en-US,en;q=0.8,id;q=0.6"},
"X-Forwarded-For": {"172.16.10.2"},
"X-Real-Ip": {"172.16.10.2"},
"User-Agent": {"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.125 Safari/537.36"},
}
내 nginx 구성:
server {
listen 443;
server_name "" _;
root /home/web/public;
error_log /home/web/error.log;
error_page 500 502 503 504 /502.html;
location / {
try_files $uri/index.html $uri @xxx;
}
location @xxx {
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off;
proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;
proxy_set_header x-forwarded-proto $scheme;
proxy_set_header host $http_host;
proxy_set_header x-forwarded $remote_addr;
proxy_pass http://xxx;
}
ssl on;
ssl_certificate /home/web/.ssh/xxx.crt;
ssl_certificate_key /home/web/.ssh/xxx.key;
}
upstream xxx {
server 127.0.0.1:12345;
}