mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 02:35:49 +08:00
Allow localhost in CorsFilter
This commit is contained in:
parent
577bf91d25
commit
a8e541159b
@ -16,6 +16,7 @@ package routers
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/beego/beego/context"
|
||||
"github.com/casdoor/casdoor/conf"
|
||||
@ -39,6 +40,11 @@ func CorsFilter(ctx *context.Context) {
|
||||
origin := ctx.Input.Header(headerOrigin)
|
||||
originConf := conf.GetConfigString("origin")
|
||||
|
||||
if strings.HasPrefix(origin, "http://localhost") {
|
||||
setCorsHeaders(ctx, origin)
|
||||
return
|
||||
}
|
||||
|
||||
if ctx.Request.Method == "POST" && ctx.Request.RequestURI == "/api/login/oauth/access_token" {
|
||||
setCorsHeaders(ctx, origin)
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user