Skip to content

Commit

Permalink
Merge pull request #7 from ninech/real-ip
Browse files Browse the repository at this point in the history
feat: configure setting real IP with header from other pods
  • Loading branch information
ctrox committed Dec 19, 2023
2 parents dfb7ed7 + a5fdca2 commit 389451e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
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

0 comments on commit 389451e

Please sign in to comment.