Skip to content

Commit 895c01a

Browse files
committedMay 2, 2024
Preserve X-Forwarded-For
1 parent b70a131 commit 895c01a

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed
 

‎services/web/nginx.conf.template

+8
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ server {
2222
proxy_pass ${HTTP_PROTOCOL}://${COMMUNITY_SERVICE};
2323
proxy_set_header Host ${COMMUNITY_SERVICE};
2424
proxy_set_header X-Forwarded-Host $http_host;
25+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
2526
sub_filter_types application/json text/html;
2627
sub_filter "://${COMMUNITY_SERVICE}" "://$http_host";
2728
sub_filter_once off;
@@ -39,6 +40,7 @@ server {
3940
proxy_pass ${HTTP_PROTOCOL}://${IDENTITY_SERVICE};
4041
proxy_set_header Host ${IDENTITY_SERVICE};
4142
proxy_set_header X-Forwarded-Host $http_host;
43+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
4244
}
4345

4446
location /workshop/ {
@@ -53,6 +55,7 @@ server {
5355
proxy_pass ${HTTP_PROTOCOL}://${WORKSHOP_SERVICE};
5456
proxy_set_header Host ${WORKSHOP_SERVICE};
5557
proxy_set_header X-Forwarded-Host $http_host;
58+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
5659
sub_filter_types application/json text/html;
5760
sub_filter "${HTTP_PROTOCOL}://${WORKSHOP_SERVICE}" "$scheme://$http_host";
5861
sub_filter_once off;
@@ -70,6 +73,7 @@ server {
7073
proxy_pass ${HTTP_PROTOCOL}://${CHATBOT_SERVICE};
7174
proxy_set_header Host ${CHATBOT_SERVICE};
7275
proxy_set_header X-Forwarded-Host $http_host;
76+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
7377
sub_filter_types application/json text/html;
7478
sub_filter "://${CHATBOT_SERVICE}" "://$http_host";
7579
sub_filter_once off;
@@ -112,6 +116,7 @@ server {
112116
proxy_pass ${HTTP_PROTOCOL}://${COMMUNITY_SERVICE};
113117
proxy_set_header Host ${COMMUNITY_SERVICE};
114118
proxy_set_header X-Forwarded-Host $http_host;
119+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
115120
sub_filter_types application/json text/html;
116121
sub_filter "://${COMMUNITY_SERVICE}" "://$http_host";
117122
sub_filter_once off;
@@ -129,6 +134,7 @@ server {
129134
proxy_pass ${HTTP_PROTOCOL}://${IDENTITY_SERVICE};
130135
proxy_set_header Host ${IDENTITY_SERVICE};
131136
proxy_set_header X-Forwarded-Host $http_host;
137+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
132138
}
133139

134140
location /workshop/ {
@@ -143,6 +149,7 @@ server {
143149
proxy_pass ${HTTP_PROTOCOL}://${WORKSHOP_SERVICE};
144150
proxy_set_header Host ${WORKSHOP_SERVICE};
145151
proxy_set_header X-Forwarded-Host $http_host;
152+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
146153
sub_filter_types application/json text/html;
147154
sub_filter "${HTTP_PROTOCOL}://${WORKSHOP_SERVICE}" "$scheme://$http_host";
148155
sub_filter_once off;
@@ -160,6 +167,7 @@ server {
160167
proxy_pass ${HTTP_PROTOCOL}://${CHATBOT_SERVICE};
161168
proxy_set_header Host ${CHATBOT_SERVICE};
162169
proxy_set_header X-Forwarded-Host $http_host;
170+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
163171
sub_filter_types application/json text/html;
164172
sub_filter "${HTTP_PROTOCOL}://${CHATBOT_SERVICE}" "$scheme://$http_host";
165173
sub_filter_once off;

‎services/web/nginx.ssl.conf.template

+8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ server {
2121
proxy_pass ${HTTP_PROTOCOL}://${COMMUNITY_SERVICE};
2222
proxy_set_header Host ${COMMUNITY_SERVICE};
2323
proxy_set_header X-Forwarded-Host $http_host;
24+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
2425
sub_filter_types application/json text/html;
2526
sub_filter "${HTTP_PROTOCOL}://${COMMUNITY_SERVICE}" "$scheme://$http_host";
2627
sub_filter_once off;
@@ -40,6 +41,7 @@ server {
4041
proxy_pass ${HTTP_PROTOCOL}://${IDENTITY_SERVICE};
4142
proxy_set_header Host ${IDENTITY_SERVICE};
4243
proxy_set_header X-Forwarded-Host $http_host;
44+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
4345
proxy_ssl_verify off;
4446
proxy_ssl_trusted_certificate /app/certs/server.crt;
4547
}
@@ -56,6 +58,7 @@ server {
5658
proxy_pass ${HTTP_PROTOCOL}://${WORKSHOP_SERVICE};
5759
proxy_set_header Host ${WORKSHOP_SERVICE};
5860
proxy_set_header X-Forwarded-Host $http_host;
61+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
5962
sub_filter_types application/json text/html;
6063
sub_filter "${HTTP_PROTOCOL}://${WORKSHOP_SERVICE}" "$scheme://$http_host";
6164
sub_filter_once off;
@@ -75,6 +78,7 @@ server {
7578
proxy_pass ${HTTP_PROTOCOL}://${CHATBOT_SERVICE};
7679
proxy_set_header Host ${CHATBOT_SERVICE};
7780
proxy_set_header X-Forwarded-Host $http_host;
81+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
7882
sub_filter_types application/json text/html;
7983
sub_filter "${HTTP_PROTOCOL}://${CHATBOT_SERVICE}" "$scheme://$http_host";
8084
sub_filter_once off;
@@ -121,6 +125,7 @@ server {
121125
proxy_pass ${HTTP_PROTOCOL}://${COMMUNITY_SERVICE};
122126
proxy_set_header Host ${COMMUNITY_SERVICE};
123127
proxy_set_header X-Forwarded-Host $http_host;
128+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
124129
sub_filter_types application/json text/html;
125130
sub_filter "${HTTP_PROTOCOL}://${COMMUNITY_SERVICE}" "$scheme://$http_host";
126131
sub_filter_once off;
@@ -138,6 +143,7 @@ server {
138143
proxy_pass ${HTTP_PROTOCOL}://${IDENTITY_SERVICE};
139144
proxy_set_header Host ${IDENTITY_SERVICE};
140145
proxy_set_header X-Forwarded-Host $http_host;
146+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
141147
}
142148

143149
location /workshop/ {
@@ -152,6 +158,7 @@ server {
152158
proxy_pass ${HTTP_PROTOCOL}://${WORKSHOP_SERVICE};
153159
proxy_set_header Host ${WORKSHOP_SERVICE};
154160
proxy_set_header X-Forwarded-Host $http_host;
161+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
155162
sub_filter_types application/json text/html;
156163
sub_filter "${HTTP_PROTOCOL}://${WORKSHOP_SERVICE}" "$scheme://$http_host";
157164
sub_filter_once off;
@@ -169,6 +176,7 @@ server {
169176
proxy_pass ${HTTP_PROTOCOL}://${CHATBOT_SERVICE};
170177
proxy_set_header Host ${CHATBOT_SERVICE};
171178
proxy_set_header X-Forwarded-Host $http_host;
179+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
172180
sub_filter_types application/json text/html;
173181
sub_filter "://${CHATBOT_SERVICE}" "://$http_host";
174182
sub_filter_once off;

0 commit comments

Comments
 (0)
Failed to load comments.