mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 20:50:19 +08:00
fix: fix cors filter (#847)
* fix: fix cors filter * Update cors_filter.go Co-authored-by: Yang Luo <hsluoyz@qq.com>
This commit is contained in:

committed by
GitHub

parent
f0431701c9
commit
b4bf734fe8
@ -31,7 +31,9 @@ const (
|
|||||||
|
|
||||||
func CorsFilter(ctx *context.Context) {
|
func CorsFilter(ctx *context.Context) {
|
||||||
origin := ctx.Input.Header(headerOrigin)
|
origin := ctx.Input.Header(headerOrigin)
|
||||||
if origin != "" && origin != conf.GetConfigString("origin") {
|
originConf := conf.GetConfigString("origin")
|
||||||
|
|
||||||
|
if origin != "" && originConf != "" && origin != originConf {
|
||||||
if object.IsAllowOrigin(origin) {
|
if object.IsAllowOrigin(origin) {
|
||||||
ctx.Output.Header(headerAllowOrigin, origin)
|
ctx.Output.Header(headerAllowOrigin, origin)
|
||||||
ctx.Output.Header(headerAllowMethods, "POST, GET, OPTIONS")
|
ctx.Output.Header(headerAllowMethods, "POST, GET, OPTIONS")
|
||||||
|
Reference in New Issue
Block a user