Mojolicious::Plugin::RequestBase - Support setting base in frontend proxy
The "X-Request-Base" header must be set in the frontend proxy.
# nxinx proxy_set_header X-Request-Base "https://example.com/myapp";
This plugin will read the "X-Request-Base" header.
# Mojolicious $app->plugin("RequestBase"); # Mojolicious::Lite plugin "RequestBase";
URL generating helpers, such as url_for will create the correct URL using the base URL from
# /myapp/foo $c->url_for; # https://example.com/myapp/foo $c->url_for->to_abs; # https://example.com/myapp/some/path $c->url_for("/some/path")->to_abs; # https://example.com/foo (Probably not what you want) $c->req->url->to_abs;
Simple plugin to support Request Base header. Just load it and set X-Request-Base in your Frontend Proxy. For instance, if you are using nginx you could use it like this:
proxy_set_header X-Request-Base 'https://example.com/myapp';
Register plugin in Mojolicious application.
Copyright (C) 2011, Marcus Ramberg.
This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0.