mirror of
https://github.com/1f349/lavender.git
synced 2024-12-22 07:34:06 +00:00
Trim / from end of origin
This commit is contained in:
parent
be3a09b73a
commit
03df1556e7
@ -9,6 +9,7 @@ import (
|
|||||||
"github.com/rs/cors"
|
"github.com/rs/cors"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@ -71,7 +72,7 @@ func NewHttpServer(conf Conf, signer mjwt.Signer) *HttpServer {
|
|||||||
var corsAccessControl = cors.New(cors.Options{
|
var corsAccessControl = cors.New(cors.Options{
|
||||||
AllowOriginFunc: func(origin string) bool {
|
AllowOriginFunc: func(origin string) bool {
|
||||||
load := hs.services.Load()
|
load := hs.services.Load()
|
||||||
_, ok := (*load)[origin]
|
_, ok := (*load)[strings.TrimSuffix(origin, "/")]
|
||||||
return ok
|
return ok
|
||||||
},
|
},
|
||||||
AllowedMethods: []string{http.MethodPost, http.MethodOptions},
|
AllowedMethods: []string{http.MethodPost, http.MethodOptions},
|
||||||
|
Loading…
Reference in New Issue
Block a user