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) }