-
I have seen a couple of videos and read some documentation and I really want to implement it, so I have created a YARP server-proxy solution, and as a test, I set to the destination, one to google and another one to a local solution, but unfortunately, as the path is replaced to my current local URL (https://localhost:44321/), the destination is not displaying the static files like .js, .css or images. I have tried including app.UseStaticFiles() in my Startup.cs and this does not work. Routes: {
"RouteId": "example",
"ClusterId": "cluster3",
"AuthorizationPolicy": "customPolicy",
"Match": {
"Path": "/example"
},
"Transforms": [
{ "PathRemovePrefix": "/example" },
{
"ResponseHeader": "Source",
"Append": "YARP",
"When": "Success"
}
]
},
{
"RouteId": "verstalocal",
"ClusterId": "cluster4",
"AuthorizationPolicy": "customPolicy",
"Match": {
"Path": "/verstalocal"
},
"Transforms": [
{ "PathRemovePrefix": "/verstalocal" },
{
"ResponseHeader": "Source",
"Append": "YARP",
"When": "Success"
}
]
}
Destinations:
Where should I indicate that it has to use the correct resources? Thanks for your help! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 11 replies
-
|
Beta Was this translation helpful? Give feedback.
-
Hi! I have tried to append /verstalocal to Path or Pathbase but this did not work: app.Use((context, next) =>
{
context.Request.PathBase = new PathString("/verstalocal");
return next();
}); app.Use((context, next) =>
{
if (context.Request.Path.StartsWithSegments("/static", out var remainder))
{
context.Request.Path = "/verstalocal/static" + remainder;
}
return next();
}); My route is: {
"RouteId": "verstalocal",
"ClusterId": "cluster4",
"AuthorizationPolicy": "customPolicy",
"Match": {
"Path": "/verstalocal/{**catch-all}"
},
"Transforms": [{
"PathRemovePrefix": "/verstalocal"
}]
}
"cluster4": {
"Destinations": {
"cluster4/destination1": {
"Address": "http://127.0.0.1:5555"
}
}
} I will really appreciate if you can share any idea or clue. |
Beta Was this translation helpful? Give feedback.
-
"Path": "/verstalocal/{**catch-all}"
},
"Transforms": [
{"PathPattern": "{**catchall}"},
{ "PathPrefix": "/verstalocal" }
]} That combination ends up with the same result as if you didn't have any transforms. What url is the site redirecting to? This "/verstalocal/" prefix might not be a viable option when working with your destination server. There's only so much the proxy can do to fight what the destination wants to do. |
Beta Was this translation helpful? Give feedback.
That combination ends up with the same result as if you didn't have any transforms.
What url is the site redirecting to?
This "/verstalocal/" prefix might not be a viable option when working with your destination server. There's only so much the proxy can do to fight what the destination wants to do.