1

I've made a Lambda / API Gateway function that has a proxy param as the final param in the URL.

  page:
    handler: handlers/website/getRenderedPage.get
    events:
      - http:
          method: get
          path: /content/{website}/{proxy+}
          cors: true
          request:
            parameters:
              paths:
                proxy: true
                website: true  

So, as defined, this is the behavior I'm experiencing:

  • /content/site.com/blog/hello-world --> website: site.com, proxy: blog/hello-world --> URL works successfully in browser.
  • /content/site.com --> website: site.com --> URL fails in browser (missing authentication token, aka API resource not found).

Is it possible to make that {proxy+} parameter optional?

1 Answer 1

3

Just have it listen to two events.

  • /content/{website} and
  • /content/{website}/{proxy+}
Sign up to request clarification or add additional context in comments.

2 Comments

That's what I've been doing, but I recently ran into resource limits in my CF template, so I was hoping to eliminate a few endpoints
Well, the / means you need to separate them. What happens if you call /content/site.com/ instead?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.