From: Dylan William Hardison Date: Mon, 15 Oct 2018 22:51:57 +0000 (-0400) Subject: add simple hack to work in GKE X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b333f545dedeea7d93e2597f8f83f5c9daf4be9;p=thirdparty%2Fbugzilla.git add simple hack to work in GKE --- diff --git a/Bugzilla/Quantum/Plugin/Hostage.pm b/Bugzilla/Quantum/Plugin/Hostage.pm index 63fad2be2..d9f0f218d 100644 --- a/Bugzilla/Quantum/Plugin/Hostage.pm +++ b/Bugzilla/Quantum/Plugin/Hostage.pm @@ -3,6 +3,10 @@ use 5.10.1; use Mojo::Base 'Mojolicious::Plugin'; use Bugzilla::Logging; +my %HEALTH_CHECK_UA = ( + "GoogleHC/1.0" => 1, +); + sub _attachment_root { my ($base) = @_; return undef unless $base; @@ -40,9 +44,15 @@ sub _before_routes { my $req = $c->req; my $url = $req->url->to_abs; - return if $stash->{'mojo.static'}; - my $hostname = $url->host; + + my $ua = $req->headers->user_agent; + if ($ua && $HEALTH_CHECK_UA{ $ua }) { + $c->render(text => "Hello, $ua, I am healthy.", status => 200); + return; + } + + return if $stash->{'mojo.static'}; return if $hostname eq $urlbase_host; my $path = $url->path;