Implement www redirect due to swagg.net downtime

This commit is contained in:
swagg boi 2022-05-28 09:41:35 -04:00
parent df23c45309
commit 5303d254da

View file

@ -14,10 +14,10 @@ plugin 'Config';
plugin CGI => ['/cgi-bin/guest.cgi', './cgi-bin/guest_mm.cgi']; plugin CGI => ['/cgi-bin/guest.cgi', './cgi-bin/guest_mm.cgi'];
plugin CGI => ['/cgi-bin/whoami.cgi', './cgi-bin/whoami.cgi']; plugin CGI => ['/cgi-bin/whoami.cgi', './cgi-bin/whoami.cgi'];
# Handle the session
under sub { under sub {
my ($c) = @_; my ($c) = @_;
my $sessionLife = 604800; my $sessionLife = 604800;
my $hostHeader = $c->req->headers->host();
if ($c->cookie('banner') eq 'seen') { if ($c->cookie('banner') eq 'seen') {
# Set session for a week # Set session for a week
@ -33,6 +33,11 @@ under sub {
# https://paramdeo.com/blog/opting-your-website-out-of-googles-floc-network # https://paramdeo.com/blog/opting-your-website-out-of-googles-floc-network
$c->res->headers->header('Permissions-Policy', 'interest-cohort=()'); $c->res->headers->header('Permissions-Policy', 'interest-cohort=()');
# Work around for swagg.net downtime 05/28/2022
unless ($hostHeader =~ /^www\./ || app->mode() eq 'development') {
$c->redirect_to("$scheme://www.swagg.net")
}
1; 1;
}; };