Short url redirector with no database required. DotNet Core 3.1 and Net 5/6 version.
Language: C#
Platform: ASP.Net Core 3.1, Net 5/6
- No database required.
- Multiple host names supported.
- Management
- Edit the configuration file directly when HTTPS is not available.
- Due to lack of support of http code 308 in IE on Windows 7 / 8.1, do NOT check "Use HTTP 308" / "Use HTTP 308 instead of 307" if you need to support old IE versions.
When a request is received by ShortUrl, it will follow these steps.
- Gets the
hostfrom the HTTP Header.- When
preferXForwardedHostin configuration file is set totrueandX-Forwarded-Hostexists in HTTP Header, gets thehostfromX-Forwarded-Host. - Gets the
hostfromHostin HTTP Header.
- When
- Gets the
path segmentsfrom the HTTP Header as theaccess key. - Enters the Global Management page when
- The
access keyequals toGlobal Management Key. And, - The
hostis allowed to enter Global Management page when- The
hostexists(*1) inGlobal Management Enabled Hosts. Or, - The list
Global Management Enabled Hostsis empty.
- The
- The
- Resolves by aliases when the
hostequals(*1) theAliascolumn of one record inAliasesfrom Global Management, choosingTargetas the new value ofhostand restart this step. Aliases could be resolved recursively with 16 as the max depth. - Processes the request against the domain when the
hostequals(*1)Domaincolumn of one record inDomainsfrom Global Management.- Enters the Domain Management page when
access keyequals toDomain Management Key. - Resolves by redirects when the
access keyequals(*2) the address column of one record in Redirects from Domain Management of this domain.- When the
Targetfrom the record matched is starting with>, gets the text after>fromTargetas the new value ofaccess keyand restart this step. Redirects could be resolved recursively with 16 as the max depth. Or, - Redirects to
Targetspecified of the record matched.
- When the
- Redirects to
Default Redirect Targetspecified in Domain Management of this domain if it is not empty.
- Enters the Domain Management page when
- Redirects to
Default Redirect Targetspecified in Global Management.
*1: Host name matching rules:
- Host name matching is case insensitive.
- Port number 80 or 443 should not present, but all others should and will be treated separately. For example:
- The record "example.com" will be matched with the host "example.com", "example.com:80" and "example.com:443".
- The record "example.com:8080" will be matched with the host "example.com:8080" only.
- The record with the key ends with ":80" or ":443" in domains or aliases will not be matched unless it's pointed by other matched alias records.
*2: Name matching could be case sensitive or insensitive, based on the setting Ignore Case When Matching specified in the Domain Management of the related domain.
When redirecting:
- HTTP 308 will be used, when
Use HTTP 308 instead of 307orUse HTTP 308is selected. Or HTTP 307 will be used. - When
Attach Query Processis enabled and the query string exists from the request:- When character
?presents in the target of the redirection,&and the query string from the request will be appended. - When character
?absents from the target of the redirection,?and the query string from the request will be appended.
- When character
- When
Attach Query Processis disabled, the query string, if exists, from the request will be dropped and will not be passed into the redirection target.