Skip to content

Commit 871ae5d

Browse files
author
Dominick Brasileiro
committed
feat: add X-Forwarded HTTP headers
1 parent 1653904 commit 871ae5d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cmd/root.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ var rootCmd = &cobra.Command{
2828
}
2929

3030
reverseProxy := http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
31+
req.Header.Set("X-Forwarded-For", req.RemoteAddr)
32+
req.Header.Set("X-Forwarded-Host", req.Header.Get("Host"))
33+
req.Header.Set("X-Forwarded-Port", port)
34+
req.Header.Set("X-Forwarded-Proto", req.Proto)
35+
3136
req.Host = originServerURL.Host
3237
req.URL.Host = originServerURL.Host
3338
req.URL.Scheme = originServerURL.Scheme

0 commit comments

Comments
 (0)