【发布时间】:2020-10-13 07:39:17
【问题描述】:
在我的 Angular 应用程序中,所有 HTTP 资源在获取时都会自动更改为 https。我检查了服务器,并没有为 https 配置自动重定向设置。
以下是我在控制台和网络选项卡中遇到的错误。
core.js:3864 ERROR
HttpErrorResponse {headers: HttpHeaders, status: 0, statusText: "Unknown Error", url: "http://xxxxxx-env.eba-prmacaby.ap-south-1.elasticbeanstalk.com/all/hub/", ok: false, …}
error: ProgressEvent {isTrusted: true, lengthComputable: false, loaded: 0, total: 0, type: "error", …}
headers: HttpHeaders {normalizedNames: Map(0), lazyUpdate: null, headers: Map(0)}
message: "Http failure response for http://xxxxx-env.eba-prmacaby.ap-south-1.elasticbeanstalk.com/all/hub/: 0 Unknown Error"
name: "HttpErrorResponse"
ok: false
status: 0
statusText: "Unknown Error"
url: "http://xxxxxx-env.eba-prmacaby.ap-south-1.elasticbeanstalk.com/all/hub/"
__proto__: HttpResponseBase
在控制台中显示的是 HTTP,但在网络选项卡中显示的是 HTTPS。
请求代码
constructor(private http: HttpClient) { }
getHub( ): Observable<Hub> {
return this.http.get<Hub>("http://xxxxxxxx-env.eba-prmacaby.ap-south-1.elasticbeanstalk.com/all/hub" );
}
【问题讨论】:
-
看不到截图,能否将错误信息分享为文字?
-
@shadowman_93 我用控制台中的错误文本编辑了描述。
-
请检查你的IIS配置,你有这样的配置吗? stackoverflow.com/a/38686154/5955138
-
不,我没有任何这样的配置
-
在此处添加您的请求代码,没有代码我无法帮助您。
标签: angular angular-http