Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'no_forwarder' Option to Public Frontend #610

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## v0.4.28

FEATURE: Added `no_forwarder` option to the public frontend configuration to avoid setting client addresses of intermediate infrastructure (https://github.com/openziti/zrok/issues/609)

CHANGE: the container images run as "ziggy" (UID 2171) instead of the generic restricted user "nobody" (UID 65534). This reduces the risk of unexpected file permissions when binding the Docker host's filesystem to a zrok container.

CHANGE: the Docker sharing guides were simplified and expanded
Expand Down
13 changes: 7 additions & 6 deletions endpoints/publicProxy/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ import (
const V = 3

type Config struct {
V int
Identity string
Address string
HostMatch string
Oauth *OauthConfig
Tls *endpoints.TlsConfig
V int
Identity string
Address string
HostMatch string
NoForwarder bool
Oauth *OauthConfig
Tls *endpoints.TlsConfig
}

type OauthConfig struct {
Expand Down
3 changes: 3 additions & 0 deletions endpoints/publicProxy/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ func newServiceProxy(cfg *Config, ctx ziti.Context) (*httputil.ReverseProxy, err
director := proxy.Director
proxy.Director = func(req *http.Request) {
director(req)
if cfg.NoForwarder {
req.Header["X-Forwarded-For"] = nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a pretty well-known header, but it appears twice in zrok. It'd be nice to use a const imo

}
req.Header.Set("X-Proxy", "zrok")
}
proxy.ModifyResponse = func(resp *http.Response) error {
Expand Down