Skip to content

Commit e4a00db

Browse files
committed
Enable real IP to get the correct IP when behind a proxy or load balancer
1 parent b23d8ad commit e4a00db

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

config/nginx.conf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ http {
3232
# Based on CloudFlare's recommended settings
3333
gzip_types text/richtext text/plain text/css text/x-script text/x-component text/x-java-source text/x-markdown application/javascript application/x-javascript text/javascript text/js image/x-icon image/vnd.microsoft.icon application/x-perl application/x-httpd-cgi text/xml application/xml application/rss+xml application/vnd.api+json application/x-protobuf application/json multipart/bag multipart/mixed application/xhtml+xml font/ttf font/otf font/x-woff image/svg+xml application/vnd.ms-fontobject application/ttf application/x-ttf application/otf application/x-otf application/truetype application/opentype application/x-opentype application/font-woff application/eot application/font application/font-sfnt application/wasm application/javascript-binast application/manifest+json application/ld+json application/graphql+json application/geo+json;
3434
gzip_vary on;
35+
36+
# Enable Real IP to get the correct client IP address when behind a proxy or load balancer
37+
set_real_ip_from 10.0.0.0/8;
38+
set_real_ip_from 172.16.0.0/12;
39+
set_real_ip_from 192.168.0.0/16;
40+
real_ip_header X-Forwarded-For;
41+
real_ip_recursive on;
3542

3643
# Forward the cloudfront scheme from upstream
3744
map "$http_cloudfront_forwarded_proto$http_x_forwarded_proto" $forwarded_scheme {

0 commit comments

Comments
 (0)