Switching to HTTP API and trailing slash issue

I’m trying to converting a service to use HTTP API instead of API Gateway so I’ve changed all the HTTP events to:

  tests:
    handler: functions/tests.main
    events:
      - http:
          path: /tests
          method: get
          cors: true

The problem is that now if call the service with a trailing slash (https://service.com/tests/) I get a 404 error, it has to be exactly without the trailing slash.
If I use API Gateway instead both URLs work.

Is there any way to make it work with or without the trailing slash?

1 Like