Skip to content

Commit

Permalink
Revert "fix: api sub route path"
Browse files Browse the repository at this point in the history
This reverts commit 34ac047.
  • Loading branch information
arvindh123 committed Feb 19, 2024
1 parent fb452db commit 4821f18
Showing 1 changed file with 15 additions and 26 deletions.
41 changes: 15 additions & 26 deletions docker/nginx/nginx-key.conf
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,19 @@ 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
# /groups/{userGroupID}/channels - Listing of channels belongs to userGroupID
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
Expand All @@ -97,55 +95,50 @@ 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
# /users/{userID}/domains - Listing of Domains belongs to userID
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
# /domains/{domainID}/users - Listing of Users belongs to domainID
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;
}


# Proxy pass to auth service
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 {
Expand All @@ -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 {
Expand All @@ -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.
Expand Down

0 comments on commit 4821f18

Please sign in to comment.