I'd like to make my developer portal even easier to discover. Our proxies are all hosted at api.acme.com/something, and I'd like our portal to be at api.acme.com. I'd settle for a redirect to developers.acme.com and send a 302 from api.acme.com if that is required.
I've tried adding a new proxy with a base path of / and setting the return code etc, but that means every request to api.acme.com/something gets sent to developers.acme.com/something.
Can you help?
Solved! Go to Solution.
I've tried adding a new proxy with a base path of / and setting the return code etc, but that means every request to api.acme.com/something gets sent to developers.acme.com/something.
Yes, I think I understand.
The way it should work:
if you have a proxy listening at basepath / , as well as a proxy listyening at basepath /something, then the latter proxy will handle calls to vhost/something while the former will handle ALL other requests (all calls that don't have /something as a basepath).
In short, the routing logic finds the most-specific match.
Therefore, as long as you have a proxy that listens on /something , then a request to api.acme.com/something should be handled by THAT proxy. Then you can also have a fallback proxy that listens on /, and therefore a request to api.acme.com/otherthing will be routed to that fallback proxy.
If you don't want the /otherthing to be sent to the developer portal; in other words if you want api.acme.com/otherthing to be redirected to developers.acme.com/ (no path), then you need to re-work the logic in your fallback proxy so that it strips any basepath and always issues a Location header that uses the path of / (iow, no path at all).
Does this help?
I've tried adding a new proxy with a base path of / and setting the return code etc, but that means every request to api.acme.com/something gets sent to developers.acme.com/something.
Yes, I think I understand.
The way it should work:
if you have a proxy listening at basepath / , as well as a proxy listyening at basepath /something, then the latter proxy will handle calls to vhost/something while the former will handle ALL other requests (all calls that don't have /something as a basepath).
In short, the routing logic finds the most-specific match.
Therefore, as long as you have a proxy that listens on /something , then a request to api.acme.com/something should be handled by THAT proxy. Then you can also have a fallback proxy that listens on /, and therefore a request to api.acme.com/otherthing will be routed to that fallback proxy.
If you don't want the /otherthing to be sent to the developer portal; in other words if you want api.acme.com/otherthing to be redirected to developers.acme.com/ (no path), then you need to re-work the logic in your fallback proxy so that it strips any basepath and always issues a Location header that uses the path of / (iow, no path at all).
Does this help?
I'm not quite sure what I did wrong before but I gave it another go and it works as expected.