-
Hello there! This project is promising, I like the idea of having my main AspNetCore application running on Kestrel allowing to redirect just certain traffic to a different web server without a third party application and/or machine in the mix. Unfortunately, I have to say your configuration documentation is severely lacking. It barely list all possible config entries and redirect to the api documentation that shows the types and a short sentence, but it doesn't have any concrete examples. I'm trying to redirect all traffic matching a certain Path and a certain subdomain (Host) to another IP. Here my config: "ReverseProxy": {
"Routes": {
"route1" : {
"ClusterId": "cluster1",
"Match": {
"Path": "/test/{*any}"
}
},
"route2" : {
"ClusterId": "cluster1",
"Match": {
"Hosts": [ "test.*" ],
}
}
},
"Clusters": {
"cluster1": {
"Destinations": {
"destination1": {
"Address": "https://localhost:5001/test"
}
},
"HttpClient": {
"DangerousAcceptAnyServerCertificate": "true"
},
}
}
}, Problem # 1: The path match works, but end up redirecting to /test/test:`
A bit confusing since it's the same name here, but the point is that the path to match might not be the same than the path to redirect to. I would have expected only the part inside the {*any} statement to be appended to the destination URL, not the whole path including the static matching word "test". Problem # 2: Hosts redirection never get caught at all. I connect to test.mydomain.com or test.localhost and it doesn't seems to be handled and just show my normal website with no redirect entry in the logfile. I even tried with full domain "Hosts": [ "test.mydomain.com" ], nothing. Eventually I wish to have a wildcard so that it works on many domain without having to re-write the configuration. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
|
Beta Was this translation helpful? Give feedback.
The path isn't modified by the route match but you can use transforms for that. See https://microsoft.github.io/reverse-proxy/articles/transforms.html#pathpattern
"test." isn't a supported host routing wildcard pattern, only full domains or wildcard prefixes (".mydomain.com") are supported. "test.mydomain.com" should have worked. Can you share a fiddler trace of that request?