Domain Binding but not using for URL Generation
a
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?
I’m now planning on writing a middleware that will alter the request, if it works it will be a much cleaner solution
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); }
6 Views