fetch('https://vanishingdante.github.io/gh-pages-blog-api/2017/02/11/bye-world')
.then(resp => resp.json())
.then(json => console.log(json))
我想從我的GH-頁(GH-頁Access-Control-Allow-Origin
爲*
)HTTPS是通過瀏覽器取消我的要求被視爲HTTP requeset
獲取的json數據通過我所得到的是這樣的:
what code I use and what I get
,我檢查了Chrome的devtool網絡面板:
network panel in Chrome's devtool
https請求被瀏覽器取消,我的提取被視爲http請求。
爲什麼,以及如何解決這個
curl https://vanishingdante.github.io/gh-pages-blog-api/2017/02/11/bye-world -i
將獲得:
HTTP/1.1 301 Moved Permanently
Server: GitHub.com
Content-Type: text/html
Location: http://vanishingdante.github.io/gh-pages-blog-api/2017/02/11/bye-world/
Access-Control-Allow-Origin: *
Expires: Mon, 20 Feb 2017 07:08:43 GMT
Cache-Control: max-age=600
X-GitHub-Request-Id: F932:2F9ED:6B263C9:9012708:58AA93A3
Content-Length: 178
Accept-Ranges: bytes
Date: Mon, 20 Feb 2017 06:58:43 GMT
Via: 1.1 varnish
Age: 0
Connection: keep-alive
X-Served-By: cache-nrt6121-NRT
X-Cache: MISS
X-Cache-Hits: 0
X-Timer: S1487573923.394396,VS0,VE179
Vary: Accept-Encoding
X-Fastly-Request-ID: 7acb3e168a104bffe672ee2c77215cd750197a3f
<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx</center>
</body>
</html>
請求HTTPS將被重定向到http
curl http://vanishingdante.github.io/gh-pages-blog-api/2017/02/11/bye-world -i
將獲得:
HTTP/1.1 301 Moved Permanently
Server: GitHub.com
Content-Type: text/html
Location: https://vanishingdante.github.io/gh-pages-blog-api/2017/02/11/bye-world
X-GitHub-Request-Id: C9E0:786B:3CE9A28:5028A16:58AA941A
Content-Length: 178
Accept-Ranges: bytes
Date: Mon, 20 Feb 2017 07:00:43 GMT
Via: 1.1 varnish
Age: 0
Connection: keep-alive
X-Served-By: cache-nrt6122-NRT
X-Cache: MISS
X-Cache-Hits: 0
X-Timer: S1487574043.118608,VS0,VE179
Vary: Accept-Encoding
X-Fastly-Request-ID: d4377ad8a08c54c1328558908b91941739f27279
<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx</center>
</body>
</html>
和http請求將被reddirect到https
但我的網站是在9天前創建的,HTTPS強制執行 – Vanis