Hi all,
Currently I have this set to configure the base URL (I have my code running on a couple of different servers):
$self->hook(
before_dispatch => sub {
my $self = shift;
my $base_url = "http://$ENV{SERVER_NAME}/";
$self->req->url->base( Mojo::URL->new($base_url) );
}
);
And it works beautifully. However, I realised that it doesn't work on anything but Apache. I'm starting to muck around with morbo and get a bunch of these errors:
Use of uninitialized value $ENV{"SERVER_NAME"} in concatenation (.) or string at script/../lib/Site.pm line 38.
I use the server name as in the title of each page, too. Is there a "native Mojolicious" way to do this that will work across Apache/CGI and Morbo etc?
Thanks!