Skip to content

Commit

Permalink
refactor(gateway): remove unnecessary rewrite rules from nginx config
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavosbarreto committed Jul 22, 2024
1 parent 0eaee90 commit a84c859
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions gateway/nginx/conf.d/shellhub.conf
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ server {
auth_request_set $api_key $upstream_http_x_api_key;
auth_request_set $role $upstream_http_x_role;
error_page 500 =401 /auth;
rewrite ^/api/(.*)$ /api/$1 break;
proxy_http_version 1.1;
proxy_set_header Connection $connection_upgrade;
proxy_set_header X-Api-Key $api_key;
Expand Down Expand Up @@ -121,7 +120,6 @@ server {
auth_request_set $id $upstream_http_x_id;
auth_request_set $role $upstream_http_x_role;
error_page 500 =401 /auth;
rewrite ^/api/(.*)$ /api/$1 break;
proxy_set_header X-ID $id;
proxy_set_header X-Request-ID $request_id;
proxy_set_header X-Role $role;
Expand Down Expand Up @@ -241,7 +239,6 @@ server {
location /api/announcements {
{{ template "UPSTREAM_CONFIG" (args "Host" "cloud-api" "Port" "8080") }}

rewrite ^/api/(.*)$ /api/$1 break;
proxy_pass http://upstream_router;
}
{{ end -}}
Expand All @@ -256,7 +253,6 @@ server {
auth_request_set $id $upstream_http_x_id;
auth_request_set $role $upstream_http_x_role;
error_page 500 =401 /auth;
rewrite ^/api/(.*)$ /api/$1 break;
proxy_http_version 1.1;
proxy_set_header X-ID $id;
proxy_set_header X-Role $role;
Expand All @@ -276,7 +272,6 @@ server {
auth_request_set $id $upstream_http_x_id;
auth_request_set $role $upstream_http_x_role;
error_page 500 =401 /auth;
rewrite ^/api/(.*)$ /api/$1 break;
proxy_set_header X-Tenant-ID $tenant_id;
proxy_set_header X-Username $username;
proxy_set_header X-ID $id;
Expand All @@ -295,7 +290,6 @@ server {
auth_request_set $id $upstream_http_x_id;
auth_request_set $role $upstream_http_x_role;
error_page 500 =401 /auth;
rewrite ^/api/(.*)$ /api/$1 break;
proxy_http_version 1.1;
proxy_set_header X-ID $id;
proxy_set_header X-Role $role;
Expand All @@ -312,7 +306,6 @@ server {
auth_request /auth;
auth_request_set $id $upstream_http_x_id;
error_page 500 =401 /auth;
rewrite ^/api/(.*)$ /api/$1 break;
proxy_set_header X-ID $id;
proxy_set_header X-Real-IP $x_real_ip;
proxy_pass http://$upstream;
Expand All @@ -322,7 +315,6 @@ server {
{{ template "UPSTREAM_CONFIG" (args "Host" "cloud-api" "Port" "8080") }}

auth_request off;
rewrite ^/api/(.*)$ /api/$1 break;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Real-IP $x_real_ip;
proxy_pass http://$upstream;
Expand All @@ -332,7 +324,6 @@ server {
{{ template "UPSTREAM_CONFIG" (args "Host" "cloud-api" "Port" "8080") }}

auth_request off;
rewrite ^/api/(.*)$ /api/$1 break;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Real-IP $x_real_ip;
proxy_pass http://$upstream;
Expand All @@ -342,7 +333,6 @@ server {
{{ template "UPSTREAM_CONFIG" (args "Host" "cloud-api" "Port" "8080") }}

auth_request off;
rewrite ^/api/(.*)$ /api/$1 break;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Real-IP $x_real_ip;
proxy_pass http://$upstream;
Expand Down Expand Up @@ -401,7 +391,6 @@ server {
auth_request_set $username $upstream_http_x_username;
auth_request_set $role $upstream_http_x_role;
error_page 500 =401 /auth;
rewrite ^/api/(.*)$ /api/$1 break;
proxy_http_version 1.1;
proxy_set_header X-Role $role;
proxy_set_header X-Tenant-ID $tenant_id;
Expand All @@ -419,7 +408,6 @@ server {
auth_request_set $username $upstream_http_x_username;
auth_request_set $role $upstream_http_x_role;
error_page 500 =401 /auth;
rewrite ^/api/(.*)$ /api/$1 break;
proxy_http_version 1.1;
proxy_set_header X-Role $role;
proxy_set_header X-Tenant-ID $tenant_id;
Expand All @@ -435,7 +423,6 @@ server {
auth_request_set $tenant_id $upstream_http_x_tenant_id;
auth_request_set $role $upstream_http_x_role;
error_page 500 =401 /auth;
rewrite ^/api/(.*)$ /$1 break;
proxy_set_header X-Role $role;
proxy_set_header X-Tenant-ID $tenant_id;
proxy_pass http://upstream_router;
Expand All @@ -445,7 +432,6 @@ server {
{{ template "UPSTREAM_CONFIG" (args "Host" "api" "Port" "8080") }}

auth_request off;
rewrite ^/api/(.*)$ /api/$1 break;
{{ if $cfg.EnableProxyProtocol -}}
proxy_set_header X-Real-IP $proxy_protocol_addr;
{{ else -}}
Expand All @@ -460,15 +446,13 @@ server {
{{ template "UPSTREAM_CONFIG" (args "Host" "api" "Port" "8080") }}

auth_request off;
rewrite ^/api/(.*)$ /api/$1 break;
proxy_pass http://upstream_router;
}

location /api/webhook-billing {
{{ template "UPSTREAM_CONFIG" (args "Host" "billing-api" "Port" "8080") }}

auth_request off;
rewrite ^/api/(.*)$ /api/$1 break;
proxy_pass http://upstream_router;
}

Expand Down

0 comments on commit a84c859

Please sign in to comment.