rm domain handling
This commit is contained in:
@@ -17,42 +17,5 @@ namespace aka.terribledev.io
|
|||||||
["react-samples"] = "https://github.com/terribledev/react-samples",
|
["react-samples"] = "https://github.com/terribledev/react-samples",
|
||||||
["react-sample"] = "https://github.com/terribledev/react-samples"
|
["react-sample"] = "https://github.com/terribledev/react-samples"
|
||||||
};
|
};
|
||||||
|
|
||||||
public static string CalculateHostRedirect(string host)
|
|
||||||
{
|
|
||||||
if(host.StartsWith("github", System.StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return "https://github.com/terribledev";
|
|
||||||
}
|
|
||||||
if(host.StartsWith("bitbucket", System.StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return "https://bitbucket.org/TerribleDev/";
|
|
||||||
}
|
|
||||||
if(host.StartsWith("api", System.StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return "http://api.terribledev.io/";
|
|
||||||
}
|
|
||||||
if(host.StartsWith("resume", System.StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return "http://resume.terribledev.io/";
|
|
||||||
}
|
|
||||||
if(host.StartsWith("soupinsummer.co", System.StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return "https://about.terribledev.io";
|
|
||||||
}
|
|
||||||
if(host.Equals("tommyparnell.com", System.StringComparison.OrdinalIgnoreCase) || host.Equals("www.tommyparnell.com", System.StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return "https://about.terribledev.io";
|
|
||||||
}
|
|
||||||
if(host.Equals("tparnell.io", System.StringComparison.OrdinalIgnoreCase) || host.Equals("www.tparnell.io", System.StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return "https://about.terribledev.io";
|
|
||||||
}
|
|
||||||
if(host.Equals("terribledev.io", System.StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return "https://about.terribledev.io";
|
|
||||||
}
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,23 +44,6 @@ namespace aka.terribledev.io
|
|||||||
{
|
{
|
||||||
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
|
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
|
||||||
loggerFactory.AddDebug();
|
loggerFactory.AddDebug();
|
||||||
app.Use(async (context, next) => {
|
|
||||||
|
|
||||||
if(context.Request.Host.Host.Equals("aka.terribledev.io", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
//if we're targeting the forwarder, don't bother doing host calculations. Routes only
|
|
||||||
await next?.Invoke();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var result = Routes.CalculateHostRedirect(context.Request.Host.Host);
|
|
||||||
if(string.IsNullOrWhiteSpace(result))
|
|
||||||
{
|
|
||||||
await next?.Invoke();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
context.Response.Redirect(result, true);
|
|
||||||
|
|
||||||
});
|
|
||||||
app.UseRouter(a=>{
|
app.UseRouter(a=>{
|
||||||
a.MapGet("favicon.ico", b=>
|
a.MapGet("favicon.ico", b=>
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user