Trim / from end of origin

This commit is contained in:
Melon 2023-12-14 23:50:09 +00:00
parent be3a09b73a
commit 03df1556e7
Signed by: melon
GPG Key ID: 6C9D970C50D26A25

View File

@ -9,6 +9,7 @@ import (
"github.com/rs/cors"
"log"
"net/http"
"strings"
"sync/atomic"
"time"
)
@ -71,7 +72,7 @@ func NewHttpServer(conf Conf, signer mjwt.Signer) *HttpServer {
var corsAccessControl = cors.New(cors.Options{
AllowOriginFunc: func(origin string) bool {
load := hs.services.Load()
_, ok := (*load)[origin]
_, ok := (*load)[strings.TrimSuffix(origin, "/")]
return ok
},
AllowedMethods: []string{http.MethodPost, http.MethodOptions},