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

feat: configure setting real IP with header from other pods #7

Merged
merged 1 commit into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions assets/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ $(( else ))
etag 'off';
$(( end ))

$((- if .SetRealIPFrom ))
set_real_ip_from $(( .SetRealIPFrom ));
$(( end ))

# (Security) Don't serve dotfiles, except .well-known/, which is needed by
# LetsEncrypt
location ~ /\.(?!well-known) {
Expand Down
2 changes: 2 additions & 0 deletions build.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ func Build(logger scribe.Emitter) packit.BuildFunc {
// https://github.com/paketo-buildpacks/nginx/issues/447
LastModifiedValue: time.Now().UTC().Format(http.TimeFormat),
ETag: false,
// allow from Pod CIDR
SetRealIPFrom: "10.42.0.0/16",
Configuration: nginx.Configuration{
NGINXConfLocation: nginxConf,
WebServerRoot: webRoot,
Expand Down
1 change: 1 addition & 0 deletions default_config_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type DefaultConfigGenerator struct {
type Configuration struct {
LastModifiedValue string
ETag bool
SetRealIPFrom string
nginx.Configuration
}

Expand Down