Reputation: 1
Hi I am trying to send PATCH
request to ServiceStack from AngularJS, getting this error:
Method PATCH is not allowed by Access-Control-Allow-Methods.
This are the request headers:
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Access-Control-Request-Method: PATCH
Origin:
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36
Access-Control-Request-Headers: accept, content-type
Accept: */*
Referer: https://pankajb1.dev.ma.net/ui/static/index.html
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-GB,en-US;q=0.8,en;q=0.6
This is the response:
HTTP/1.1 200 OK
Cache-Control: private
Content-Length: 0
Server: Microsoft-IIS/7.5
X-Powered-By: ServiceStack/3.959 Win32NT/.NET
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Headers: Content-Type
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Fri, 25 Sep 2015 20:23:51 GMT
Upvotes: 0
Views: 317
Reputation: 143359
The CorsFeature
by default didn't allow PATCH (it will in next v4.0.48 release).
In the meantime you can specify which methods should be available for CORS when registering the CorsFeature
, e.g:
Plugins.Add(new CorsFeature(
allowedMethods: "GET, POST, PUT, DELETE, PATCH, OPTIONS"));
Upvotes: 2