我建立一個無業遊民的VM安裝的Django,並設置端口轉發這樣的:Vagrant - Django服務器 - 爲什麼主機重定向到https?
config.vm.network "forwarded_port", guest: 8000, host: 8001
所以在客戶機器,我會像這樣的Django服務器:
python manage.py 0.0.0.0:8000
,服務器將啓動並告訴我它的運行http://127.0.0.1:8000
當我在主機上打開firefox並將其指向http://127.0.0.1:8001
時,它會自動重定向到https://127.0.0.1:8001
,並且出現此錯誤:
An error occurred during a connection to 127.0.0.1:8001. SSL received a record that exceeded the maximum permissible length. Error code: SSL_ERROR_RX_RECORD_TOO_LONG
無法在settings.py
文件中強制https。我不知道是什麼導致它重定向到https,或者我可以怎樣去解決這個問題。這是virtualbox,vagrant或django的問題嗎?
這些錯誤消息出現在終端,我運行服務器:
[06/Jan/2017 05:17:22] code 400, message Bad request syntax ('\x16\x03\x01\x00¥\x01\x00\x00¡\x03\x03d')
You're accessing the development server over HTTPS, but it only supports HTTP.
[06/Jan/2017 05:17:31] code 400, message Bad HTTP/0.9 request type ("\x16\x03\x01\x00¥\x01\x00\x00¡\x03\x03É\[email protected]¦Û2\x
9c'\x1a5n¬òðÿ𪪮pÛ%å\x15#8jÕQé\x00\x00")
You're accessing the development server over HTTPS, but it only supports HTTP.
所以,問題是爲什麼我的瀏覽器試圖訪問通過HTTPS服務器?