Simplify host restriction
This commit is contained in:
parent
c0292e080d
commit
102bd6bf30
|
@ -9,10 +9,8 @@ namespace AutheliaMultiDomainProxy.Controllers;
|
||||||
public class RedirectController : Controller {
|
public class RedirectController : Controller {
|
||||||
public IActionResult Get([FromQuery] string tgt) {
|
public IActionResult Get([FromQuery] string tgt) {
|
||||||
// Check if we are on an allowed domain
|
// Check if we are on an allowed domain
|
||||||
if (!Vars.PermittedDomains.Any(p => Request.Host.Host.EndsWith($".{p}"))) {
|
if (Vars.PermittedDomains.All(p => Request.Host.Host != $"{Vars.AuthProxySubdomain}.{p}"))
|
||||||
Response.StatusCode = 421;
|
|
||||||
return StatusCode(StatusCodes.Status421MisdirectedRequest);
|
return StatusCode(StatusCodes.Status421MisdirectedRequest);
|
||||||
}
|
|
||||||
|
|
||||||
var dstDomain = AuthHelpers.GetRootDomain(tgt);
|
var dstDomain = AuthHelpers.GetRootDomain(tgt);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue