I\'m looking for a reliable way to configure Mojolicious running behind an Apache reverse proxy under /app, so that url_for(\'/foo\')
actually returns /ap
You should mount your application under required path.
In your startup
you should do:
$r = $app->routes;
$r = $r->any( '/api' )->partial( 1 );
$r->get( '/test' );
You should not configure specially your apache. When GET /api/test
will come your app will get /api/test
route. This route partially matched to /api
and the rest route /test
will be assigned into ->stash->{ path }
.
So rest routes will be checked against /test
(source)