Skip to content

Commit c22d1f7

Browse files
committed
fixed middleware chain order
1 parent 64aee27 commit c22d1f7

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

internals/proxy/proxy.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ func AuthMiddleware(next http.Handler) http.Handler {
6464

6565
authQuery := req.URL.Query().Get("@authorization")
6666

67-
log.Debug("Auth Query: ", authQuery, "| Query: ", req.URL.RawQuery)
68-
6967
var authType AuthType = None
7068

7169
success := false
@@ -113,12 +111,6 @@ func AuthMiddleware(next http.Handler) http.Handler {
113111
}
114112
}
115113

116-
if success {
117-
log.Debug("Finished Auth Middleware with success")
118-
} else {
119-
log.Debug("Finished Auth Middleware with failure")
120-
}
121-
122114
if !success {
123115
w.Header().Set("WWW-Authenticate", "Basic realm=\"Login Required\", Bearer realm=\"Access Token Required\"")
124116

main.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,13 @@ func main() {
5454

5555
handler = proxy.Create(signalUrl)
5656

57-
finalHandler := proxy.TemplatingMiddleware(
57+
finalHandler := proxy.AuthMiddleware(
5858
proxy.BlockedEndpointMiddleware(
59-
proxy.AuthMiddleware(handler),
60-
61-
BLOCKED_ENDPOINTS),
62-
VARIABLES)
59+
proxy.TemplatingMiddleware(handler,
60+
VARIABLES ),
61+
62+
BLOCKED_ENDPOINTS ),
63+
)
6364

6465
log.Info("Initialized Proxy Handler")
6566

0 commit comments

Comments
 (0)