diff --git a/docker/nginx/nginx-key.conf b/docker/nginx/nginx-key.conf index 93cab4dc02d..fc677febfd2 100644 --- a/docker/nginx/nginx-key.conf +++ b/docker/nginx/nginx-key.conf @@ -74,8 +74,7 @@ http { location ~ ^/(channels)/(.+)/(things)/(.+) { include snippets/proxy-headers.conf; add_header Access-Control-Expose-Headers Location; - rewrite ^/api(/.*)$ $1 break; - proxy_pass http://things:${MG_THINGS_HTTP_PORT}; + proxy_pass http://things:${MG_THINGS_HTTP_PORT}/$1; } # Proxy pass to users & groups id to things service for listing of channels # /users/{userID}/channels - Listing of channels belongs to userID @@ -83,12 +82,11 @@ http { location ~ ^/(users|groups)/(.+)/(channels|things) { include snippets/proxy-headers.conf; add_header Access-Control-Expose-Headers Location; - rewrite ^/api(/.*)$ $1 break; if ($request_method = GET) { - proxy_pass http://things:${MG_THINGS_HTTP_PORT}; + proxy_pass http://things:${MG_THINGS_HTTP_PORT}/$1; break; } - proxy_pass http://users:${MG_USERS_HTTP_PORT}; + proxy_pass http://users:${MG_USERS_HTTP_PORT}/$1; } # Proxy pass to channel id to users service for listing of channels @@ -97,12 +95,11 @@ http { location ~ ^/(channels|things)/(.+)/(users|groups) { include snippets/proxy-headers.conf; add_header Access-Control-Expose-Headers Location; - rewrite ^/api(/.*)$ $1 break; if ($request_method = GET) { - proxy_pass http://users:${MG_USERS_HTTP_PORT}; + proxy_pass http://users:${MG_USERS_HTTP_PORT}/$1; break; } - proxy_pass http://things:${MG_THINGS_HTTP_PORT}; + proxy_pass http://things:${MG_THINGS_HTTP_PORT}/$1; } # Proxy pass to user id to auth service for listing of domains @@ -110,12 +107,11 @@ http { location ~ ^/(users)/(.+)/(domains) { include snippets/proxy-headers.conf; add_header Access-Control-Expose-Headers Location; - rewrite ^/api(/.*)$ $1 break; if ($request_method = GET) { - proxy_pass http://auth:${MG_AUTH_HTTP_PORT}; + proxy_pass http://auth:${MG_AUTH_HTTP_PORT}/$1; break; } - proxy_pass http://users:${MG_USERS_HTTP_PORT}; + proxy_pass http://users:${MG_USERS_HTTP_PORT}/$1; } # Proxy pass to domain id to users service for listing of users @@ -123,12 +119,11 @@ http { location ~ ^/(domains)/(.+)/(users) { include snippets/proxy-headers.conf; add_header Access-Control-Expose-Headers Location; - rewrite ^/api(/.*)$ $1 break; if ($request_method = GET) { - proxy_pass http://users:${MG_USERS_HTTP_PORT}; + proxy_pass http://users:${MG_USERS_HTTP_PORT}/$1; break; } - proxy_pass http://auth:${MG_AUTH_HTTP_PORT}; + proxy_pass http://auth:${MG_AUTH_HTTP_PORT}/$1; } @@ -136,16 +131,14 @@ http { location ~ ^/(domains) { include snippets/proxy-headers.conf; add_header Access-Control-Expose-Headers Location; - rewrite ^/api(/.*)$ $1 break; - proxy_pass http://auth:${MG_AUTH_HTTP_PORT}; + proxy_pass http://auth:${MG_AUTH_HTTP_PORT}/$1; } # Proxy pass to users service location ~ ^/(users|groups|password|authorize) { include snippets/proxy-headers.conf; add_header Access-Control-Expose-Headers Location; - rewrite ^/api(/.*)$ $1 break; - proxy_pass http://users:${MG_USERS_HTTP_PORT}; + proxy_pass http://users:${MG_USERS_HTTP_PORT}/$1; } location ^~ /users/policies { @@ -158,8 +151,7 @@ http { location ~ ^/(things|channels|connect|disconnect|identify) { include snippets/proxy-headers.conf; add_header Access-Control-Expose-Headers Location; - rewrite ^/api(/.*)$ $1 break; - proxy_pass http://things:${MG_THINGS_HTTP_PORT}; + proxy_pass http://things:${MG_THINGS_HTTP_PORT}/$1; } location ^~ /things/policies { @@ -172,20 +164,17 @@ http { location ~ ^/(invitations) { include snippets/proxy-headers.conf; add_header Access-Control-Expose-Headers Location; - rewrite ^/api(/.*)$ $1 break; - proxy_pass http://invitations:${MG_INVITATIONS_HTTP_PORT}; + proxy_pass http://invitations:${MG_INVITATIONS_HTTP_PORT}/$1; } location /health { include snippets/proxy-headers.conf; - rewrite ^/api(/.*)$ $1 break; - proxy_pass http://things:${MG_THINGS_HTTP_PORT}; + proxy_pass http://things:${MG_THINGS_HTTP_PORT}/$1; } location /metrics { include snippets/proxy-headers.conf; - rewrite ^/api(/.*)$ $1 break; - proxy_pass http://things:${MG_THINGS_HTTP_PORT}; + proxy_pass http://things:${MG_THINGS_HTTP_PORT}/$1; } ## Expose VAULT CRL, OCSP endpoint to public for verification of certificate.