This commit is contained in:
crusader 2018-04-11 20:38:26 +09:00
parent 5154784254
commit 42d71182fc

View File

@ -138,6 +138,11 @@ func (s *Server) httpHandler(ctx *fasthttp.RequestCtx) {
servlet Servlet
)
if !s.ServerHandler.CheckOrigin(ctx) {
s.onError(ctx, web.NewError(fasthttp.StatusForbidden, fmt.Errorf("Forbidden")))
return
}
if string(ctx.Method()) == "OPTIONS" && ctx.Request.Header.Peek("Access-Control-Request-Method") != nil {
ctx.SetStatusCode(fasthttp.StatusOK)
}