闢謠!nginx做不了https正向 Proxy?

來源:互聯網
上載者:User

標籤:nginx https正向 Proxy

https://my.oschina.net/duxuefeng/blog/275179

剛才搜到這文章,是兩年前發的,我覺得我有必要指出,文兒結尾的nginx不支援https代理是錯的。


650) this.width=650;" src="http://s5.51cto.com/wyfs02/M01/8A/FA/wKiom1g_8kPDCfqFAAAX5GHr6qo480.jpg" title="1.jpg" alt="wKiom1g_8kPDCfqFAAAX5GHr6qo480.jpg" />

錯誤在這兒,如果改成$http_host就對了。如下:

proxy_pass $scheme://$http_host$request_uri;


$host和$http_host的區別,網上到處可以搜得到,就不累述了。出現400錯誤的原因就是因為這個,人家請求的是https://您給硬寫個http,能對嗎?比如說代理百度,http://www.baidu.com:443,日誌裡保證寫著400錯誤,這屬於錯誤的對應關係,443是給https協議的,用http就出個400 bad request唄。

闢謠!nginx做不了https正向 Proxy?

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.