Skip to content

feat(product): T4 — fix gateway routing for product service#68

Open
devin-ai-integration[bot] wants to merge 1 commit into
devin/product-t3-api-authfrom
devin/product-t4-gateway
Open

feat(product): T4 — fix gateway routing for product service#68
devin-ai-integration[bot] wants to merge 1 commit into
devin/product-t3-api-authfrom
devin/product-t4-gateway

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

The gateway's product-route used only PathRemovePrefix: /api/products, which stripped the prefix and forwarded bare paths (/, /123) to the Product service — but the controller is mounted at api/product, so every request 404'd.

Added a PathPrefix: /api/product transform after the strip so the rewrite chain becomes:

GET /api/products         → strip → /         → prefix → /api/product         ✓
GET /api/products/123     → strip → /123      → prefix → /api/product/123     ✓
GET /api/products/categories → strip → /categories → prefix → /api/product/categories ✓

Only src/ApiGateway/appsettings.json was modified. Build passes; YARP logs confirm Proxying to …/api/product.

Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/bc5a9156cad244339c8ad8d1601e6dc2
Requested by: @mbatchelor81


Open in Devin Review

Add PathPrefix /api/product after PathRemovePrefix /api/products so the
gateway correctly rewrites:
  /api/products      → /api/product
  /api/products/123  → /api/product/123
  /api/products/categories → /api/product/categories

Previously the strip-only transform forwarded to / which returned 404.
@mbatchelor81 mbatchelor81 self-assigned this Jun 26, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Open in Devin Review

Comment on lines +29 to +32
"Transforms": [
{ "PathRemovePrefix": "/api/products" },
{ "PathPrefix": "/api/product" }
]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 Other gateway routes have the same prefix mismatch that this PR only fixes for the product route

This PR adds a PathPrefix: "/api/product" transform to the product-route to correctly forward requests to the ProductController at api/Product. However, all other routes have the same structural issue: the gateway strips the prefix (e.g. /api/customers) leaving just the remainder (e.g. /123), but the downstream controllers all use [Route("api/[controller]")] and expect paths like /api/Customer/123. For example, CustomerController at src/Services/Customer/Customer.API/Controllers/CustomerController.cs:6 uses [Route("api/[controller]")], but the gateway's customer-route at src/ApiGateway/appsettings.json:18-19 strips /api/customers and forwards just the remainder without adding back a prefix. The same applies to identity, order, and notification routes. If these routes are expected to work, they likely need similar PathPrefix transforms.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good observation — the other routes (identity, customer, order, notification) do have the same structural mismatch. However, this PR is intentionally scoped to the product route only per the task requirements. Fixing the other routes would be a separate task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant