mirror of
https://github.com/casdoor/casdoor.git
synced 2025-09-09 07:42:56 +08:00
Set OPTIONS status in setCorsHeaders()
This commit is contained in:
@@ -35,6 +35,10 @@ func setCorsHeaders(ctx *context.Context, origin string) {
|
|||||||
ctx.Output.Header(headerAllowOrigin, origin)
|
ctx.Output.Header(headerAllowOrigin, origin)
|
||||||
ctx.Output.Header(headerAllowMethods, "POST, GET, OPTIONS, DELETE")
|
ctx.Output.Header(headerAllowMethods, "POST, GET, OPTIONS, DELETE")
|
||||||
ctx.Output.Header(headerAllowHeaders, "Content-Type, Authorization")
|
ctx.Output.Header(headerAllowHeaders, "Content-Type, Authorization")
|
||||||
|
|
||||||
|
if ctx.Input.Method() == "OPTIONS" {
|
||||||
|
ctx.ResponseWriter.WriteHeader(http.StatusOK)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func getHostname(s string) string {
|
func getHostname(s string) string {
|
||||||
@@ -89,11 +93,6 @@ func CorsFilter(ctx *context.Context) {
|
|||||||
ctx.ResponseWriter.WriteHeader(http.StatusForbidden)
|
ctx.ResponseWriter.WriteHeader(http.StatusForbidden)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.Input.Method() == "OPTIONS" {
|
|
||||||
ctx.ResponseWriter.WriteHeader(http.StatusOK)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user