Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

Commit

Permalink
Merge pull request #1317 from aledbf/fix-real-ip
Browse files Browse the repository at this point in the history
[nginx-ingress-controller] Fix duplicated real_ip_header
  • Loading branch information
bprashanth authored Jul 5, 2016
2 parents 3c428b9 + d716603 commit cac6193
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions ingress/controllers/nginx/nginx.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ events {

http {
{{/* we use the value of the header X-Forwarded-For to be able to use the geo_ip module */}}
{{ if $cfg.useProxyProtocol -}}
set_real_ip_from {{ $cfg.proxyRealIpCidr }};
real_ip_header proxy_protocol;
{{ else }}
real_ip_header X-Forwarded-For;
set_real_ip_from 0.0.0.0/0;
{{ end -}}

real_ip_recursive on;

{{/* databases used to determine the country depending on the client IP address */}}
Expand Down Expand Up @@ -67,11 +73,6 @@ http {

client_max_body_size "{{ $cfg.bodySize }}";

{{ if $cfg.useProxyProtocol -}}
set_real_ip_from {{ $cfg.proxyRealIpCidr }};
real_ip_header proxy_protocol;
{{ end -}}

log_format upstreaminfo '{{ if $cfg.useProxyProtocol }}$proxy_protocol_addr{{ else }}$remote_addr{{ end }} - '
'[$proxy_add_x_forwarded_for] - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" '
'$request_length $request_time $upstream_addr $upstream_response_length $upstream_response_time $upstream_status';
Expand Down

0 comments on commit cac6193

Please sign in to comment.