From 42d71182fc3fe992ddae902a5385db7561dc655a Mon Sep 17 00:00:00 2001 From: crusader Date: Wed, 11 Apr 2018 20:38:26 +0900 Subject: [PATCH] ing --- web/fasthttp/server.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/web/fasthttp/server.go b/web/fasthttp/server.go index 1553b9a..9520c37 100644 --- a/web/fasthttp/server.go +++ b/web/fasthttp/server.go @@ -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) }