We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 55475c0 commit 14954dcCopy full SHA for 14954dc
application/referer.go
@@ -1,12 +1,14 @@
1
package application
2
3
-import "net/http"
+import (
4
+ "net/http"
5
+ "strings"
6
+)
7
8
// RefererMiddleware ensure that requests comes from the gitlab domain
9
func (a *Application) RefererMiddleware(next http.Handler) http.Handler {
10
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- referer := r.Referer()
- if referer != a.GitlabURL {
11
+ if strings.TrimRight(r.Referer(), "/") != strings.TrimRight(a.GitlabURL, "/") {
12
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
13
return
14
}
0 commit comments