On Monday, December 19, 2016 at 9:21:23 AM UTC+1, Paul Williams wrote: > > You might want to try http://p3rl.org/Mojolicious::Plugin::RequestBase > > Thanks, Paul, that did it. This solution also lurks in the t/ directory in the Mojolicious source.
For reference, here is the code I used and the corresponding Apache configuration. Yes, the slashes matter: # change the base path, if deployed under a reverse proxy, e.g. with Apache: # ProxyRequests Off # ProxyPreserveHost Off # ProxyPass /app/ http://localhost:8081/ # ProxyPassReverse /app/ http://localhost:8081/ # RequestHeader set X-Request-Base https://host.domain/app # app->hook( before_dispatch => sub { my $c = shift; if ( my $base = $c->req->headers->header('X-Request-Base') ) { $c->req->url->base( Mojo::URL->new($base) ); } } ); The application url - note the slash at the end: https://host.domain/app/ Strangely enough the url_for('/') won't add the slash at the end. So in the route '/' I just redirect to '/home', which works. Cheers -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
