Replies: 1 comment
-
|
AWS API Gateway strips the routing prefix before forwarding to your backend service. When you configure a route Fix 1: Register routes without the prefix in chi This is the simplest approach. Since API Gateway strips r.Get("/new", myHandler)
// not r.Get("/blogs/new", ...)This is the standard pattern for API Gateway integrations. Fix 2: Configure API Gateway to pass the full path In AWS API Gateway (HTTP API), you can use a Fix 3: Use If you're testing locally without a gateway and need the prefix, mount with r.Mount("/blogs", http.StripPrefix("/blogs", blogRouter))But for production behind API Gateway, option 1 is cleanest — let API Gateway handle the routing and keep your chi routes clean. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
We are using AWS api gateway that points to our chi service.
apigw.domain.com/blogs -> blogs.domain.com
When we go to any endpoint hosted by our service using the apigw, example apigw.domain.com/blogs/new we get a not found error and the path dev tools says can be found is apigw.domain.com/new ....Looks ilke the chi router is not respecting the original path.
Is there a way to configure chi to respect the path used by the apigw?
Beta Was this translation helpful? Give feedback.
All reactions