From 2faa747e2303ee774a4b4aace961188e950e185a Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 8 Apr 2024 21:09:22 +0200 Subject: Adding upstream version 2.4.58. Signed-off-by: Daniel Baumann --- docs/manual/rewrite/proxy.html.en | 119 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 docs/manual/rewrite/proxy.html.en (limited to 'docs/manual/rewrite/proxy.html.en') diff --git a/docs/manual/rewrite/proxy.html.en b/docs/manual/rewrite/proxy.html.en new file mode 100644 index 0000000..a32b9ed --- /dev/null +++ b/docs/manual/rewrite/proxy.html.en @@ -0,0 +1,119 @@ + + + + + +Using mod_rewrite for Proxying - Apache HTTP Server Version 2.4 + + + + + + + +
<-
+

Using mod_rewrite for Proxying

+
+

Available Languages:  en  | + fr 

+
+ + +

This document supplements the mod_rewrite +reference documentation. It describes +how to use the RewriteRule's [P] flag to proxy content to another server. +A number of recipes are provided that describe common scenarios.

+ +
+ +
top
+
+

Proxying Content with mod_rewrite

+ + + +
+
Description:
+ +
+

+ mod_rewrite provides the [P] flag, which allows URLs to be passed, + via mod_proxy, to another server. Two examples are given here. In + one example, a URL is passed directly to another server, and served + as though it were a local URL. In the other example, we proxy + missing content to a back-end server.

+
+ +
Solution:
+ +
+

To simply map a URL to another server, we use the [P] flag, as + follows:

+ +
RewriteEngine  on
+RewriteBase    "/products/"
+RewriteRule    "^widget/(.*)$"  "http://product.example.com/widget/$1"  [P]
+ProxyPassReverse "/products/widget/" "http://product.example.com/widget/"
+ + +

In the second example, we proxy the request only if we can't find + the resource locally. This can be very useful when you're migrating + from one server to another, and you're not sure if all the content + has been migrated yet.

+ +
RewriteCond "%{REQUEST_FILENAME}"       !-f
+RewriteCond "%{REQUEST_FILENAME}"       !-d
+RewriteRule "^/(.*)" "http://old.example.com/$1" [P]
+ProxyPassReverse "/" "http://old.example.com/"
+ +
+ +
Discussion:
+ +

In each case, we add a ProxyPassReverse directive to ensure + that any redirects issued by the backend are correctly passed on to + the client.

+ +

Consider using either ProxyPass or ProxyPassMatch whenever possible in + preference to mod_rewrite.

+
+
+ +
+
+

Available Languages:  en  | + fr 

+
top

Comments

Notice:
This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Libera.chat, or sent to our mailing lists.
+
+ \ No newline at end of file -- cgit v1.2.3