jkyberneees / fastify-gateway

A Node.js API gateway that just works!
https://www.npmjs.com/package/k-fastify-gateway
MIT License
108 stars 14 forks source link

Prefix + /* doesn't allow for top level routes #4

Closed KidkArolis closed 5 years ago

KidkArolis commented 6 years ago

I'm trying to proxy the /logout url to my api server, but I think fastify-gateway does prefix + '/*' at which point /logout doesn't match anymore.

jkyberneees commented 6 years ago

Hi Karolis, thanks for reporting. Just to clarify, in this case you want to be able to route at endpoint level? So your remote server is listening at [HTTP VERB]/ ?

jkyberneees commented 6 years ago

Hi Karolis, just release a new version that allows to override the path matching regex. Please checkout an example that satisfy your requirement:

Regards.

KidkArolis commented 6 years ago

Hm, that kinda works, it just means I would match not only /logout, but also /logout-stuff. And I can't set pathRegex to '', because it's defaulted with pathRegex || '/*'.

Locally, I've solved this with route.exactMatch ? route.prefix : route.prefix + '/*'.

But I'll try your new release and see how that goes.

jkyberneees commented 5 years ago

I get your point.

jkyberneees commented 5 years ago

I will update accordingly to allow the complete ignoring of the pathRegex. Thx

jkyberneees commented 5 years ago

Improvements here: https://github.com/jkyberneees/fastify-gateway/pull/5 Version 1.1.1 released