Is there a way to specify a catch-all in the route...
# help
d
Is there a way to specify a catch-all in the route that is acting as a proxy?
Copy code
new Api(this, "Api", {
  routes: {
    "GET /api/*": {
      url: "<http://domain.com>",
    },
  },
});
https://docs.serverless-stack.com/constructs/Api#configuring-http-proxy-routes
m
I think you can use the
{proxy+}
keyword https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-set-up-simple-proxy.html So something like:
Copy code
new Api(this, "Api", {
  routes: {
    "GET /{proxy+}": {
      url: "<http://domain.com>",
    },
  },
});
Also if you want to catch all request methods just use
ANY
instead of
GET
d
thanks
trying
f
This can also work. “$default” route is the HTTP API’s built-in catch all route.
Copy code
new Api(this, "Api", {
  routes: {
    "$default": {
      url: "<http://domain.com>",
    },
  },
});
a
@Frank the default is like
/
?
You remember the issue that I mentioned before with the root path?
f
@Adrián Mouly the
$default
is actually similar to
ANY /{proxy+}
in a way. It will catch all un-matched routes.
d
works! thanks! Just realizing that I’ve never used HTTP Apis… only ever REST APIs
f
lol yeah the HTTP vs REST API naming is not confusing at all 😉