跨域請求錯誤: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource

今天在學習Angular 的HttpInterceptor 攔截器時,發現添加了新的headers鍵值之后總是報跨域錯誤。后台使用的是asp.net core。 檢查發現,在添加了新的header之后,每次請求之前都會先發送一個options請求,這個請求被后台拒絕了,所以導致報錯。我的后台 ...

Sat Jul 13 01:39:00 CST 2019 1 10123
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM