I have a Qliksense server from domain and I have its certificate (.pfx) and I want to make a reverse proxy to it with ASP.NET Core + YARP.
The issue is when I set the proxy prefix as /qlik
for example
and go to localhost/qlik
, I get a http 404
error 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 throw a 404
error because it will search of the /hub
route which only exist on the QlikSense server and not my app
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
Is there any way to do this?
I heard about something in the transformation like:
{
"ResponseHeader": "Location",
"Set": "{Scheme}://{Host}/qlik{Headers.Location}",
"When": "Response"
}
but I get an error, not sure if I’m using it correctly.
I expect to get a solution to handle make a reverse proxy that reverse all of the qliksense routes and resources in a sub path
You can try to modify the request path and remove the prefix value by using PathRemovePrefix
in Transforms
. Here is an example for your reference:
{
"ReverseProxy": {
"Routes": {
"qlikRoute": {
"ClusterId": "qlikCluster",
"Match": {
"Path": "/qlik/{**catch-all}"
},
"Transforms": [
{
"PathRemovePrefix": "/qlik"
},
{
"ResponseHeader": "Location",
"Set": "{Scheme}://{Host}/qlik{Headers.Location}",
"When": "Success"
}
]
}
},
"Clusters": {
"qlikCluster": {
"Destinations": {
"qlikServer": {
"Address": "https://localhost:7007/"
}
}
}
}
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}
When I enter https://localhost:7061/qlik/hub in the URL
, it will jump to the target address correctly.
1