C#C
C#16mo ago
K1lleR99

[YARP] How to set up a reverse proxy for another full web server in a sub path?

I have a Qliksense server on some domain and I have its certificate (pfx) and I want to make a reverse proxy to it with ASP.NET + YARP
the issue is when I set the proxy prefix as /qlik for example
and go to localhost/qlik
it would gives me 404 because the qlik server would read /qlik as a route and will try to fine the page that called qlik
but when I remove the prefix of /qlik in the transform section
then go to localhost/qlik
the QlikSense server redirects me to another path called /hub
so it would be like localhost/qlik => localhost/hub
and this time my backend app itself is who would gives me 404 error because it will search of the /hub route which only exist on the QlikSense server and not my app

so I need a dynamic way to make all of the QlikSense paths be of sub path /qlik
like it should be when I go to localhost/qlik => localhost/qlik/hub and the qliksense server would read the path as /hub not /qlik/hub
or anyway to fix this

I heard about something in the transformation like:
{
            "ResponseHeader": "Location",
            "Set": "{Scheme}://{Host}/qlik{Headers.Location}",
            "When": "Response"
          }

but it gives me error, not sure if I'm using it correctly
Was this page helpful?