2

I have enabled global CORS support in my application

        this.Plugins.Add(new CorsFeature(
            allowCredentials: true,
            allowedHeaders: "Content-Type, Authorization",
            allowedOrigins: "*",
            allowedMethods: "GET, POST, OPTIONS"
        ));

        this.GlobalRequestFilters.Add((httpReq, httpRes, httpDto) =>
        {
            if (httpReq.Verb == "OPTIONS")
            {
                httpRes.EndRequest();
            }
        });

In my routes, I have added the OPTIONS verb (probably not necessary)

        [Route("/Mailers", "POST, GET, OPTIONS")]
        public class MailersRequest {
            public List<Int64> Properties { get; set; }
        }

Everything works great in every browser I've tried except IE 11. The new Edge browser is fine, along with Chrome. On IE 11, the OPTIONS request to /mailers gets no response at all. Here are the Request Headers:

Request URL: https://api.blahblah.com:4443/mailers
Request Method: OPTIONS
Accept: */*
Accept-Encoding: gzip, deflate
Access-Control-Request-Headers: accept, content-type
Access-Control-Request-Method: POST
Cache-Control: no-cache
Connection: Keep-Alive
Content-Length: 0
Host: api.blahblahblah.com:4443
Origin: https://www.housesellersource.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko

The request hangs in a Pending state indefinitely. Again, everything works fine in other browsers.

Any ideas? Thanks!

ItJustWerks
  • 551
  • 6
  • 20

1 Answers1

1

Firstly you don't need to specify a GlobalRequestFilters for handling an OPTIONS request, i.e:

this.GlobalRequestFilters.Add((httpReq, httpRes, dto) => {
    if (httpReq.Verb == "OPTIONS")
        httpRes.EndRequest();
});

Since OPTIONS is already handled by ServiceStack's CorsFeature.

But it appears the issue with CORS in IE is that requires a valid P3P Policy.

Community
  • 1
  • 1
mythz
  • 141,670
  • 29
  • 246
  • 390