Skip to content

Commit

Permalink
mention url_for too
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Dec 18, 2015
1 parent dfb031b commit 38c490d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Changes
@@ -1,5 +1,5 @@

6.38 2015-12-17
6.38 2015-12-18
- Updated prettify.js to version 8-Dec-2015.
- Improved form generation in Mojo::UserAgent::Transactor to use UTF-8 as the
default charset.
Expand Down
9 changes: 6 additions & 3 deletions lib/Mojolicious/Guides/Cookbook.pod
Expand Up @@ -296,8 +296,9 @@ But you could even use middleware right in your application.

Sometimes you might have to deploy your application in a blackbox environment
where you can't just change the server configuration or behind a reverse proxy
that passes along additional information with C<X-*> headers. In such cases you
can use the hook L<Mojolicious/"before_dispatch"> to rewrite incoming requests.
that passes along additional information with C<X-Forwarded-*> headers. In such
cases you can use the hook L<Mojolicious/"before_dispatch"> to rewrite incoming
requests.

# Change scheme if "X-Forwarded-HTTPS" header is set
$app->hook(before_dispatch => sub {
Expand All @@ -308,7 +309,9 @@ can use the hook L<Mojolicious/"before_dispatch"> to rewrite incoming requests.

Since reverse proxies generally don't pass along information about path
prefixes your application might be deployed under, rewriting the base path of
incoming requests is also quite common.
incoming requests is also quite common. This allows
L<Mojolicious::Controller/"url_for"> for example, to generate portable URLs
based on the current environment.

# Move first part and slash from path to base path in production mode
$app->hook(before_dispatch => sub {
Expand Down

0 comments on commit 38c490d

Please sign in to comment.