0

I'd like to be able to just drop the greedy path parameter "{proxy+}" and redirect to an existing api endpoint.

ie, if a user attempts to access www.my-website.com/api/a/b/c/d..., I'd like to simply return the response www.my-website.com/api/a would give.

So I configured API Gateway to redirect

blahblah.execute-api.region.amazonaws/com/stage/a/{proxy+}

to

blahblah.execute-api.region.amazonaws/com/stage/a

via HTTP proxy. But when trying to curl my way through to test it, I just get a "301 moved permanently" response.

How do I skip this step and return the target's response directly?

Gibberling Lard
  • 169
  • 1
  • 15
  • possible duplicate. https://stackoverflow.com/questions/34345127/rewrite-destination-path-in-api-gateway-integration-request – Garr Godfrey Jan 11 '18 at 11:10
  • @GarrGodfrey A path parameter {a} and a greedy path parameter {a+} are inherently different in the API Gateway, as the latter forces the resource into proxy mode. – Gibberling Lard Jan 11 '18 at 11:11
  • @GibberlingLard *"So I configured API Gateway to redirect ... via HTTP proxy"*. You need to explain what that actually means, because it doesn't seem obvious... via http proxy back to itself? In that case, that's a strange and inefficient solution, but it shouldn't return a 301. Perhaps capturing the request and response header and showing them would clarify this. – Michael - sqlbot Jan 12 '18 at 00:48
  • @Michael-sqlbot when configuring an '{parameter+}' type endpoint, there are only two options available - Lambda Proxy and HTTP proxy. I'm not sure how I'd clarify this further - I'm redirecting 'mysite.com/blahblahblah' to 'mysite.com', ie back to a parent point. – Gibberling Lard Jan 12 '18 at 03:53
  • Redirecting, in HTTP, means a specific thing -- a 30X response. Instead, it sounds like you're describing looping the API back onto itself... which could create quite a mess if it were allowed to indefinitely cascade, so API Gateway may be protecting itself from sending requests from its back-side, back around to its front side. – Michael - sqlbot Jan 12 '18 at 05:17

0 Answers0