Skip to content

Commit

Permalink
Preserve X-Forwarded-For
Browse files Browse the repository at this point in the history
  • Loading branch information
piyushroshan committed May 2, 2024
1 parent b70a131 commit 895c01a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions services/web/nginx.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ server {
proxy_pass ${HTTP_PROTOCOL}://${COMMUNITY_SERVICE};
proxy_set_header Host ${COMMUNITY_SERVICE};
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
sub_filter_types application/json text/html;
sub_filter "://${COMMUNITY_SERVICE}" "://$http_host";
sub_filter_once off;
Expand All @@ -39,6 +40,7 @@ server {
proxy_pass ${HTTP_PROTOCOL}://${IDENTITY_SERVICE};
proxy_set_header Host ${IDENTITY_SERVICE};
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
}

location /workshop/ {
Expand All @@ -53,6 +55,7 @@ server {
proxy_pass ${HTTP_PROTOCOL}://${WORKSHOP_SERVICE};
proxy_set_header Host ${WORKSHOP_SERVICE};
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
sub_filter_types application/json text/html;
sub_filter "${HTTP_PROTOCOL}://${WORKSHOP_SERVICE}" "$scheme://$http_host";
sub_filter_once off;
Expand All @@ -70,6 +73,7 @@ server {
proxy_pass ${HTTP_PROTOCOL}://${CHATBOT_SERVICE};
proxy_set_header Host ${CHATBOT_SERVICE};
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
sub_filter_types application/json text/html;
sub_filter "://${CHATBOT_SERVICE}" "://$http_host";
sub_filter_once off;
Expand Down Expand Up @@ -112,6 +116,7 @@ server {
proxy_pass ${HTTP_PROTOCOL}://${COMMUNITY_SERVICE};
proxy_set_header Host ${COMMUNITY_SERVICE};
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
sub_filter_types application/json text/html;
sub_filter "://${COMMUNITY_SERVICE}" "://$http_host";
sub_filter_once off;
Expand All @@ -129,6 +134,7 @@ server {
proxy_pass ${HTTP_PROTOCOL}://${IDENTITY_SERVICE};
proxy_set_header Host ${IDENTITY_SERVICE};
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
}

location /workshop/ {
Expand All @@ -143,6 +149,7 @@ server {
proxy_pass ${HTTP_PROTOCOL}://${WORKSHOP_SERVICE};
proxy_set_header Host ${WORKSHOP_SERVICE};
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
sub_filter_types application/json text/html;
sub_filter "${HTTP_PROTOCOL}://${WORKSHOP_SERVICE}" "$scheme://$http_host";
sub_filter_once off;
Expand All @@ -160,6 +167,7 @@ server {
proxy_pass ${HTTP_PROTOCOL}://${CHATBOT_SERVICE};
proxy_set_header Host ${CHATBOT_SERVICE};
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
sub_filter_types application/json text/html;
sub_filter "${HTTP_PROTOCOL}://${CHATBOT_SERVICE}" "$scheme://$http_host";
sub_filter_once off;
Expand Down
8 changes: 8 additions & 0 deletions services/web/nginx.ssl.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ server {
proxy_pass ${HTTP_PROTOCOL}://${COMMUNITY_SERVICE};
proxy_set_header Host ${COMMUNITY_SERVICE};
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
sub_filter_types application/json text/html;
sub_filter "${HTTP_PROTOCOL}://${COMMUNITY_SERVICE}" "$scheme://$http_host";
sub_filter_once off;
Expand All @@ -40,6 +41,7 @@ server {
proxy_pass ${HTTP_PROTOCOL}://${IDENTITY_SERVICE};
proxy_set_header Host ${IDENTITY_SERVICE};
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
proxy_ssl_verify off;
proxy_ssl_trusted_certificate /app/certs/server.crt;
}
Expand All @@ -56,6 +58,7 @@ server {
proxy_pass ${HTTP_PROTOCOL}://${WORKSHOP_SERVICE};
proxy_set_header Host ${WORKSHOP_SERVICE};
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
sub_filter_types application/json text/html;
sub_filter "${HTTP_PROTOCOL}://${WORKSHOP_SERVICE}" "$scheme://$http_host";
sub_filter_once off;
Expand All @@ -75,6 +78,7 @@ server {
proxy_pass ${HTTP_PROTOCOL}://${CHATBOT_SERVICE};
proxy_set_header Host ${CHATBOT_SERVICE};
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
sub_filter_types application/json text/html;
sub_filter "${HTTP_PROTOCOL}://${CHATBOT_SERVICE}" "$scheme://$http_host";
sub_filter_once off;
Expand Down Expand Up @@ -121,6 +125,7 @@ server {
proxy_pass ${HTTP_PROTOCOL}://${COMMUNITY_SERVICE};
proxy_set_header Host ${COMMUNITY_SERVICE};
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
sub_filter_types application/json text/html;
sub_filter "${HTTP_PROTOCOL}://${COMMUNITY_SERVICE}" "$scheme://$http_host";
sub_filter_once off;
Expand All @@ -138,6 +143,7 @@ server {
proxy_pass ${HTTP_PROTOCOL}://${IDENTITY_SERVICE};
proxy_set_header Host ${IDENTITY_SERVICE};
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
}

location /workshop/ {
Expand All @@ -152,6 +158,7 @@ server {
proxy_pass ${HTTP_PROTOCOL}://${WORKSHOP_SERVICE};
proxy_set_header Host ${WORKSHOP_SERVICE};
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
sub_filter_types application/json text/html;
sub_filter "${HTTP_PROTOCOL}://${WORKSHOP_SERVICE}" "$scheme://$http_host";
sub_filter_once off;
Expand All @@ -169,6 +176,7 @@ server {
proxy_pass ${HTTP_PROTOCOL}://${CHATBOT_SERVICE};
proxy_set_header Host ${CHATBOT_SERVICE};
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
sub_filter_types application/json text/html;
sub_filter "://${CHATBOT_SERVICE}" "://$http_host";
sub_filter_once off;
Expand Down

0 comments on commit 895c01a

Please sign in to comment.