Skip to content

Commit ead48e4

Browse files
committed
fix: update NGINX configuration to handle API endpoint rewrites for orders and products
1 parent b0e6a15 commit ead48e4

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

src/store-admin/nginx.conf

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ server {
4141
}
4242

4343
location /api/order {
44-
proxy_pass http://order-service:3000/;
44+
rewrite ^/api/order$ / break;
45+
rewrite ^/api/order(/.*)$ $1 break;
46+
proxy_pass http://order-service:3000;
4547
proxy_http_version 1.1;
4648
}
4749

@@ -51,7 +53,9 @@ server {
5153
}
5254

5355
location /api/products {
54-
proxy_pass http://product-service:3002/;
56+
rewrite ^/api/products$ / break;
57+
rewrite ^/api/products(/.*)$ $1 break;
58+
proxy_pass http://product-service:3002;
5559
proxy_http_version 1.1;
5660
}
5761

@@ -71,7 +75,9 @@ server {
7175
# }
7276

7377
location /api/product {
74-
proxy_pass http://product-service:3002/;
78+
rewrite ^/api/product$ / break;
79+
rewrite ^/api/product(/.*)$ $1 break;
80+
proxy_pass http://product-service:3002;
7581
proxy_http_version 1.1;
7682
}
7783

src/store-front/nginx.conf

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,16 @@ server {
2626
}
2727

2828
location /api/orders {
29-
proxy_pass http://order-service:3000/;
29+
rewrite ^/api/orders$ / break;
30+
rewrite ^/api/orders(/.*)$ $1 break;
31+
proxy_pass http://order-service:3000;
3032
proxy_http_version 1.1;
3133
}
3234

3335
location /api/products {
34-
proxy_pass http://product-service:3002/;
36+
rewrite ^/api/products$ / break;
37+
rewrite ^/api/products(/.*)$ $1 break;
38+
proxy_pass http://product-service:3002;
3539
proxy_http_version 1.1;
3640
}
3741
}

0 commit comments

Comments
 (0)