You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by st...@outerthought.org on 2003/02/05 18:00:05 UTC

[WIKI-UPDATE] HowTos ApacheModProxy Wed Feb 5 18:00:05 2003

Page: http://wiki.cocoondev.org/Wiki.jsp?page=HowTos, version: 60 on Wed Feb  5 16:15:08 2003 by PierFumagalli

- * __[Using Apache's mod_proxy with Cocoon|http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=104441321803644&w=2]__ -- A description of how to configure Apache mod_proxy as a front-end to Cocoon by [Pier Fumagalli|PierFumagalli] ([Wiki Version|ApacheModProxy]).
+ * __[Using Apache's mod_proxy with Cocoon|ApacheModProxy]__ -- A description of how to configure Apache mod_proxy as a front-end to Cocoon by [Pier Fumagalli|PierFumagalli] (Original emails part [#1|http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=104441321803644&w=2] and [#2|http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=104445792717349&w=2]).


Page: http://wiki.cocoondev.org/Wiki.jsp?page=ApacheModProxy, version: 5 on Wed Feb  5 16:12:35 2003 by PierFumagalli

-     # Make sure that Apache processes the headers coming back from the proxy
? ----

+ # Make sure that Apache processes the headers coming back from the proxy
-     # requests. This will enable also the evaluation of HTTP status codes.
? ----

+ # requests. This will enable also the evaluation of HTTP status codes.
-     ProxyPassReverse / http://localhost:8000/
? ----

+ ProxyPassReverse / http://localhost:8000/
-     # Tell mod_mod proxy that it should not send back the body-content of
? ----

+ # Tell mod_mod proxy that it should not send back the body-content of
-     # error pages, but be fascist and use its local error pages if the
? ----

+ # error pages, but be fascist and use its local error pages if the
-     # remote HTTP stack is sending an HTTP 4xx or 5xx status code.
? ----

+ # remote HTTP stack is sending an HTTP 4xx or 5xx status code.
-     ProxyErrorOverride On
? ----

+ ProxyErrorOverride On
-     # For each individual error we want to handle, let's specify what file
? ----

+ # For each individual error we want to handle, let's specify what file
-     # we want to use. Note that all files must be available through a
? ----

+ # we want to use. Note that all files must be available through a
-     # locally accessible directory (as our /static/), and they can even be
? ----

+ # locally accessible directory (as our /static/), and they can even be
-     # SSI files (SHTML files).
? ----

+ # SSI files (SHTML files).
-     ErrorDocument 404 /static/notfound.shtml
? ----

+ ErrorDocument 404 /static/notfound.shtml
-     ErrorDocument 500 /static/error.shtml
? ----

+ ErrorDocument 500 /static/error.shtml
-     ErrorDocument 502 /static/unavailable.shtml
? ----

+ ErrorDocument 502 /static/unavailable.shtml
-     # Make sure that the virtual host name is passed through to the
? ----

+ # Make sure that the virtual host name is passed through to the
-     # backend servlet container for virtual host support.
? ----

+ # backend servlet container for virtual host support.
-     ProxyPreserveHost On
? ----

+ ProxyPreserveHost On
- !!Putting it all together
+ !!Putting it all together (step 2)
?                          +++++++++

+ {{{
+ #######################################################################
+ # GLOBAL CONFIGURATIONS                                               #
+ #######################################################################
-     #######################################################################
-     # GLOBAL CONFIGURATIONS                                               #
-     #######################################################################
+ # Make sure that my document root points to the root of the web
+ # application (where the WEB-INF is located, for instance).
+ DocumentRoot /export/webapps/cocoon
-     # Make sure that my document root points to the root of the web
-     # application (where the WEB-INF is located, for instance).
-     DocumentRoot /export/webapps/cocoon
+ # Make sure that Server Side Includes are processed and sent
+ # to the client with mime-type as text/html
+ AddType text/html .shtml
+ AddOutputFilter Includes .shtml
-     # Make sure that Server Side Includes are processed and sent
-     # to the client with mime-type as text/html
-     AddType text/html .shtml
-     AddOutputFilter Includes .shtml
+ # Make sure that our SHTMLs are processed in the static
+ # directory
+ <Directory "/export/webapps/cocoon">
+     Options +IncludesNoExec
+ </Directory>
+ #######################################################################
+ # ERROR PAGES CONFIGURATION                                           #
+ #######################################################################
-     # Make sure that our SHTMLs are processed in the static
-     # directory
-     <Directory "/export/webapps/cocoon">
-         Options +IncludesNoExec
-     </Directory>
-     #######################################################################
-     # ERROR PAGES CONFIGURATION                                           #
-     #######################################################################
+ # If mod_proxy cannot connect to the servlet container, we want
+ # to display a nice static page saying the reason. This is a
+ # SHTML page (using the Server-Side-Includes filter)
+ ErrorDocument 502 /static/unavailable.shtml
-     # If mod_proxy cannot connect to the servlet container, we want
-     # to display a nice static page saying the reason. This is a
-     # SHTML page (using the Server-Side-Includes filter)
+ # For each individual error we want to handle, let's specify what file
+ # we want to use. Note that all files must be available through a
+ # locally accessible directory (as our /static/), and they can even be
+ # SSI files (SHTML files).
+ ErrorDocument 404 /static/notfound.shtml
-     ErrorDocument 502 /static/unavailable.shtml
? ----                ^         ----------

+ ErrorDocument 500 /static/error.shtml
?                 ^          ++++

+ #######################################################################
+ # MOD_PROXY CONFIGURATIONS                                            #
+ #######################################################################
-     # For each individual error we want to handle, let's specify what file
-     # we want to use. Note that all files must be available through a
-     # locally accessible directory (as our /static/), and they can even be
-     # SSI files (SHTML files).
-     ErrorDocument 404 /static/notfound.shtml
-     ErrorDocument 500 /static/error.shtml
-     #######################################################################
-     # MOD_PROXY CONFIGURATIONS                                            #
-     #######################################################################
+ # Make sure that if the servlet container specifies a "Location" HTTP
+ # header during redirection starting with "http://localhost:8080/", we
+ # can handle it and return to our client the effective (not real)
+ # location we want to redirect them to. This is _essential_ to handle
+ # also the error returned by the backend servlet container.
+ ProxyPassReverse / http://localhost:8080/
+ # Make sure that the virtual host name is passed through to the
+ # backend servlet container for virtual host support.
+ ProxyPreserveHost On
-     # Make sure that if the servlet container specifies a "Location" HTTP
-     # header during redirection starting with "http://localhost:8080/", we
-     # can handle it and return to our client the effective (not real)
-     # location we want to redirect them to. This is _essential_ to handle
-     # also the error returned by the backend servlet container.
-     ProxyPassReverse / http://localhost:8080/
-     # Make sure that the virtual host name is passed through to the
-     # backend servlet container for virtual host support.
-     ProxyPreserveHost On
+ # Tell mod_mod proxy that it should not send back the body-content of
+ # error pages, but be fascist and use its local error pages if the
+ # remote HTTP stack is sending an HTTP 4xx or 5xx status code.
+ ProxyErrorOverride On
+ #######################################################################
+ # MOD_REWRITE CONFIGURATIONS                                          #
+ #######################################################################
-     # Tell mod_mod proxy that it should not send back the body-content of
-     # error pages, but be fascist and use its local error pages if the
-     # remote HTTP stack is sending an HTTP 4xx or 5xx status code.
-     ProxyErrorOverride On
+ # The nastiness begins, let's fire up the "rewrite engine"
+ RewriteEngine On
-     #######################################################################
-     # MOD_REWRITE CONFIGURATIONS                                          #
-     #######################################################################
-     # The nastiness begins, let's fire up the "rewrite engine"
-     RewriteEngine On
+ # Everything that starts with "/static" or "/static/" is served straight
+ # through: no redirection, no proxying, no nothing, and the [L] flag
+ # implies that if this rule is matched, no other matching must be
+ # performed
+ RewriteRule "^/static/?(.*)" "$0" [L]
-     # Everything that starts with "/static" or "/static/" is served straight
-     # through: no redirection, no proxying, no nothing, and the [L] flag
-     # implies that if this rule is matched, no other matching must be
-     # performed
-     RewriteRule "^/static/?(.*)" "$0" [L]
+ # Everything that starts with a NON-CASE-SENSITIVE match (the NC flag)
+ # of "/WEB-INF" or "/WEB-INF/" is forbidden (the F flag). And again,
+ # this is the last rule (the L flag), nothing will be processed by the
+ # rewrite engine if this rule is matched
+ RewriteRule "^/WEB-INF/?(.*)" "$0" [L,F,NC]
-     # Everything that starts with a NON-CASE-SENSITIVE match (the NC flag)
-     # of "/WEB-INF" or "/WEB-INF/" is forbidden (the F flag). And again,
-     # this is the last rule (the L flag), nothing will be processed by the
-     # rewrite engine if this rule is matched
-     RewriteRule "^/WEB-INF/?(.*)" "$0" [L,F,NC]
+ # Everything ending in ".gif", ".jpg" or ".jpeg" will be served again
+ # directly by Apache, no need to bother the servlet container. As above
+ # this is the last rule as specified by the [L] flag at the end
+ RewriteRule "^/(.*)\.gif$" "$0" [L]
+ RewriteRule "^/(.*)\.(jpg|jpeg)$" "$0" [L]
-     # Everything ending in ".gif", ".jpg" or ".jpeg" will be served again
-     # directly by Apache, no need to bother the servlet container. As above
-     # this is the last rule as specified by the [L] flag at the end
-     RewriteRule "^/(.*)\.gif$" "$0" [L]
-     RewriteRule "^/(.*)\.(jpg|jpeg)$" "$0" [L]
- 
-     # Everything else not matched above needs to go to the servlet container
? ----

+ # Everything else not matched above needs to go to the servlet container
-     # via HTTP listening on port 8080. The [P] flag (which is required)
? ----

+ # via HTTP listening on port 8080. The [P] flag (which is required)
-     # implies that our requests will be handled by mod_proxy.
? ----

+ # implies that our requests will be handled by mod_proxy.
-     RewriteRule "^/(.*)" "http://localhost:8080/$1" [P]
? ----

+ RewriteRule "^/(.*)" "http://localhost:8080/$1" [P]
+ }}}
- <VirtualHost> section of your httpd.conf (obviously after having applied the
+ {{<VirtualHost>}} section of your {{httpd.conf}} (obviously after having applied the
? ++             ++                 ++          ++

- right now. Together, those three little pieces _will_ conquer the world.
+ right now. Together, those three little pieces __will__ conquer the world.
?                                                 +    +

- Have fun...
+ Have fun...\\[Pier|PierFumagalli]