Hello, We have a rather rare requirement (client's Azure setup environment) that we bind certain domains to certain nodes, but not use that in generated front end urls.
Am I right in thinking I need to use a Url Provider to override the default and remove certain urls that start with the given domain?
Aaron Sawyer
03/28/2024, 11:45 PM
I’m now planning on writing a middleware that will alter the request, if it works it will be a much cleaner solution
Aaron Sawyer
03/29/2024, 6:58 PM
for those curious, this works like a charm:
public async Task Invoke(HttpContext httpContext)
{
var myRequest = httpContext.Request;
string hiddenDomain = "localhost:44366";
string targetDomain = "target.local:44366";
if (httpContext.Request.Host.Value.Equals(hiddenDomain))
{
//rewrite to a given target
httpContext.Request.Host = new HostString(targetDomain) { };
}
await _next(httpContext);
}