我正在本地机器上使用 Angular8 和 RxJS。
我尝试从 bandcamp.com 端点获取数据,但遇到了 CORS 问题。已经通过创建代理修复了它:
proxy.conf.json
{
"/": {
"target": {
"host": "bandcamp.com",
"protocol": "https:"
},
"secure": true,
"logLevel": "debug",
"changeOrigin": true
}
}
作为没有子域的页面的魅力,例如。 https://bandcamp.com/gift_cards
在 https://localhost:4200/gift_cards
url 获取子域 [https://humanworth.bandcamp.com/album/boys
] 时出现问题。
我尝试了 https://humanworth.localhost:4200/album/boys
,显然 - 没有错误:
获取https://humanworth.localhost:4200/album/boys net::ERR_SSL_PROTOCOL_ERROR 错误 HttpErrorResponse {headers: HttpHeaders,状态:0,状态文本:“未知错误”,网址: “https://humanworth.localhost:4200/album/boys”,好的:false,...}
如何从这样的 url 获得正确的响应,以及(更重要的是)为什么它不起作用?