Commit | Line | Data |
ac304f06 |
1 | NAME |
deac99b3 |
2 | Catalyst::TraitFor::Request::ProxyBase - Replace request base with value |
3 | passed by HTTP proxy |
ac304f06 |
4 | |
5 | SYNOPSIS |
6 | package MyApp; |
7 | use Moose; |
8 | use namespace::autoclean; |
9 | |
10 | use Catalyst; |
11 | use CatalystX::RoleApplicator; |
12 | |
13 | extends 'Catalyst'; |
14 | |
15 | __PACKAGE__->apply_request_class_roles(qw/ |
16 | Catalyst::TraitFor::Request::ProxyBase |
17 | /); |
18 | |
19 | __PACKAGE__->setup; |
20 | |
21 | DESCRIPTION |
22 | This module is a Moose::Role which allows you more flexibility in your |
23 | application's deployment configurations when deployed behind a proxy. |
24 | |
25 | The problem is that there is no standard way for a proxy to tell a |
26 | backend server what the original URI for the request was, or if the |
27 | request was initially SSL. (Yes, I do know about "X-Forwarded-Host", but |
28 | they don't do enough) |
29 | |
30 | This creates an issue for someone wanting to deploy the same cluster of |
31 | application servers behind various URI endpoints. |
32 | |
33 | Using this module, the request base ("$c->req->base") is replaced with |
34 | the contents of the "X-Request-Base" header, which is expected to be a |
35 | full URI, for example: |
36 | |
37 | http://example.com |
38 | https://example.com |
39 | http://other.example.com:81/foo/bar/yourapp |
40 | |
41 | This value will then be used as the base for uris constructed by |
42 | "$c->uri_for". |
43 | |
44 | REQUIRED METHODS |
45 | base |
46 | secure |
47 | |
48 | WRAPPED METHODS |
49 | base |
50 | secure |
51 | |
52 | BUGS |
53 | Probably. Patches welcome, please fork from: |
54 | |
55 | http://github.com/bobtfish/catalyst-traitfor-request-proxybase |
56 | |
57 | and send a pull request. |
58 | |
59 | AUTHOR |
60 | Tomas Doran (t0m) "<bobtfish@bobtfish.net>" |
61 | |
62 | COPYRIGHT |
63 | This module is Copyright (c) 2009 Tomas Doran and is licensed under the |
64 | same terms as perl itself. |
65 | |