Cors Error on GET Request

Yun Chang Lee asked on January 19, 2022 06:56

I encountered error status 405 Method Not Allowed on OPTIONS Pre-flight. I configured the kentico cms with everything i can on Access-Control-Allow-Methods and the response header shows the correct method as well. However, i notice that there are another Allow key in response header as well, i suspect that is the issue that my request fail. But I cannot find the settings for this Allow header anywhere, can i remove this Allow header? Or are there any other settings i possibly missed out?

Here are all my Response Headers from pre-flights OPTIONS request:

HTTP/1.1 405 Method Not Allowed
Cache-Control: private
Allow: GET, PUT, POST, DELETE
Content-Type: text/html; charset=UTF-8
Server: Microsoft-IIS/8.5
X-Frame-Options: SAMEORIGIN
X-AspNet-Version: 4.0.30319
Set-Cookie: ASP.NET_SessionId=gpvyrhgjk0cpplzn1uir2tcx; path=/; HttpOnly; SameSite=Lax
X-Powered-By: ASP.NET
Access-Control-Allow-Origin: http://localhost:7888
Access-Control-Allow-Methods: GET, POST, DELETE, PUT, OPTIONS
Access-Control-Allow-Headers: Authorization,Origin, X-Requested-With, Content-Type, Accept
Access-Control-Allow-Credentials: true
Date: Wed, 19 Jan 2022 05:09:26 GMT
Content-Length: 1565

Here are all my Request Headers from pre-flights OPTIONS request:

OPTIONS /kentico_admin/rest/content/currentsite/en-us/document/Header HTTP/1.1
Host: preview.website.net
Connection: keep-alive
Accept: */*
Access-Control-Request-Method: GET
Access-Control-Request-Headers: authorization
Origin: http://localhost:7888
User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36
Sec-Fetch-Mode: cors
Referer: http://localhost:7888/
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9

Recent Answers


Trevor Fayas answered on January 24, 2022 06:01

Cors errors usually result from one of the following:

  1. Improper site domain setup (make sure the admin and site domains are accurate)
  2. Trying to hit the website on https when admin http
  3. Macro hash salt being different between admin and site
  4. Browser cache issue (clear cache)
  5. Possible startup.cs misconfiguration

Check these!

0 votesVote for this answer Mark as a Correct answer

Eugene Paden answered on February 16, 2022 21:31

can you share your CORS settings?

the CORS Configuration reference would be of great help.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.