Using ServiceStack as an API Level

We currently have one large C # ServiceStack API project for all services in our system. I want to split this into a smaller API that works separately, for ease of deployment and testing. Pretty similar to what is described here by Mike Hadlow.

However, instead of using Nginx, I would like to use ServiceStack as a reverse proxy. This "external" API will handle authentication problems and then redirect any incoming request to the corresponding internal API using the async HTTP REST call.

How would I create this service agent? Say I have an internal API that accepts a call / hello. If I try to create my own ServiceRunner on an external API host, I cannot just intercept ANY call. It still expects some routes to be present, so the call / hello on the external API will fail. Do I need to create a dummy / hi-route on an external API host in order to be able to intercept them using my own ServiceRunner? Looking at the rest of ServiceStack, I'm sure there is a cleaner way.

Bonus points, if they can still be combined with Swagger :)

+7
source share
2 answers

At the time this question was originally asked, there was no easy way to create a lookup template from the root of the service base URL. That is, if the service was located at the root, there was no easy way to create a wildcard pattern / {*}, just as if the service was located at another point, say / api, there was no easy way to create a / api / {*} wildcard route.

However, support The last path has been added to ServiceStack ( see a detailed implementation example. ). Using the fallback route, you can proxy all unrecognized requests in the background without listing them in your ServiceStack project. However, it does not provide Swagger support.

+1
source

You can easily convert ServiceStack to a reverse proxy with the new Proxy Feature added in v4.5.10 .

0
source

All Articles