diff --git a/server/Caddyfile b/server/Caddyfile index c354ea3..adfde2a 100644 --- a/server/Caddyfile +++ b/server/Caddyfile @@ -8,6 +8,10 @@ file_server { root /home/hmn/hmn } + header { + Access-Control-Allow-Origin * + Access-Control-Allow-Methods "GET, OPTIONS" + } } handle { reverse_proxy localhost:9001 diff --git a/src/website/requesthandling.go b/src/website/requesthandling.go index e7a9dea..daeebd8 100644 --- a/src/website/requesthandling.go +++ b/src/website/requesthandling.go @@ -144,7 +144,7 @@ func (c *RequestContext) FullUrl() string { if scheme == "" { proto, hasProto := c.Req.Header["X-Forwarded-Proto"] if hasProto { - scheme = fmt.Sprintf("%s://", proto) + scheme = fmt.Sprintf("%s://", proto[0]) } } @@ -155,6 +155,7 @@ func (c *RequestContext) FullUrl() string { scheme = "http://" } } + return scheme + c.Req.Host + c.Req.URL.String() }