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

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:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>{
"ResponseHeader": "Location",
"Set": "{Scheme}://{Host}/qlik{Headers.Location}",
"When": "Response"
}
</code>
<code>{ "ResponseHeader": "Location", "Set": "{Scheme}://{Host}/qlik{Headers.Location}", "When": "Response" } </code>
{
    "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:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>{
"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": "*"
}
</code>
<code>{ "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": "*" } </code>
{
  "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

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật