Skip to content

Commit

Permalink
Merge pull request #787 from aledbf/pass-server-header
Browse files Browse the repository at this point in the history
Add setting to allow returning the Server header from the backend
  • Loading branch information
aledbf authored May 28, 2017
2 parents 3a9e3fd + 2f20c6b commit 32f2438
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions controllers/nginx/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ const (
type Configuration struct {
defaults.Backend `json:",squash"`

// AllowBackendServerHeader enables the return of the header Server from the backend
// instead of the generic nginx string.
// http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_hide_header
// By default this is disabled
AllowBackendServerHeader bool `json:"allow-backend-server-header"`

// EnableDynamicTLSRecords enables dynamic TLS record sizes
// https://blog.cloudflare.com/optimizing-tls-over-tcp-to-reduce-latency
// By default this is enabled
Expand Down Expand Up @@ -288,6 +294,7 @@ type Configuration struct {
// NewDefault returns the default nginx configuration
func NewDefault() Configuration {
cfg := Configuration{
AllowBackendServerHeader: false,
ClientHeaderBufferSize: "1k",
ClientBodyBufferSize: "8k",
EnableDynamicTLSRecords: true,
Expand Down
4 changes: 4 additions & 0 deletions controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ http {

proxy_ssl_session_reuse on;

{{ if $cfg.AllowBackendServerHeader }}
proxy_pass_header Server;
{{ end }}

{{range $name, $upstream := $backends}}
upstream {{$upstream.Name}} {
{{ if eq $upstream.SessionAffinity.AffinityType "cookie" }}
Expand Down

0 comments on commit 32f2438

Please sign in to comment.