@@ 23,6 23,14 @@ public abstract class AbstractRoute {
}
public virtual void Options(ref HttpListenerRequest req, ref HttpListenerResponse res) {
+ if (Cors) {
+ res.Headers.Add("Access-Control-Allow-Origin", "*");
+ res.Headers.Add("Access-Control-Allow-Headers", "*");
+ res.Headers.Add("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
+ res.Headers.Add("Access-Control-Max-Age", "86400");
+ EmptyResponse.Create(ref res);
+ return;
+ }
EmptyResponse.Create(ref res, HttpStatusCode.MethodNotAllowed);
}