Wiki source code of Setting up the Apache HTTP Server Proxy
Version 10.1 by Lane Duncan on 2024/03/19
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | Example inpired from https://www.myxwiki.org (with only the important parts): | ||
2 | |||
3 | * any acces to port ##80## redirect to port ##443## | ||
4 | * proxy the port ##443## to the port ##8080## (where most application servers are listening by default) | ||
5 | * redirect ##/## access to ##/xwiki/## | ||
6 | * make sure XWiki have enough information to know what is the source URL | ||
7 | * make sure that special characters like ##/## and ##+## are allowed | ||
8 | * Mind the "noncanon" keyword. Without it, URLs containing semicolons will be mangled | ||
9 | * Tomcat server.xml should include the following connector attributes (default: 8080 connector) in order to avoid some "mixed protocol" failures: | ||
10 | ** proxyName="my.wiki.hostname" | ||
11 | ** proxyPort="443" | ||
12 | ** scheme="https" | ||
13 | {{code language="xml"}}<Connector port="8080" protocol="HTTP/1.1" | ||
14 | connectionTimeout="20000" | ||
15 | proxyName="wiki.example.com" | ||
16 | proxyPort="443" | ||
17 | scheme="https" | ||
18 | redirectPort="8443" | ||
19 | maxParameterCount="1000" | ||
20 | />{{/code}} | ||
21 | |||
22 | ==Sample apache httpd conf file== | ||
23 | {{code language="xml"}} | ||
24 | <VirtualHost *:80> | ||
25 | ServerName mydomain.com | ||
26 | ServerAlias *.mydomain.com | ||
27 | |||
28 | RewriteEngine On | ||
29 | RewriteCond %{HTTPS} off | ||
30 | RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L] | ||
31 | </VirtualHost> | ||
32 | |||
33 | <VirtualHost *:443> | ||
34 | ServerName mydomain.com | ||
35 | ServerAlias *.mydomain.com | ||
36 | |||
37 | DocumentRoot /var/www/ | ||
38 | |||
39 | ErrorLog /var/log/apache2/xwiki-error.log | ||
40 | CustomLog /var/log/apache2/xwiki-access.log combined | ||
41 | |||
42 | RedirectMatch ^/$ /xwiki/ | ||
43 | |||
44 | <Location /xwiki> | ||
45 | Order Deny,Allow | ||
46 | Satisfy Any | ||
47 | </Location> | ||
48 | |||
49 | AllowEncodedSlashes NoDecode | ||
50 | |||
51 | ProxyRequests Off | ||
52 | <Proxy *> | ||
53 | Order deny,allow | ||
54 | Allow from all | ||
55 | </Proxy> | ||
56 | ProxyPreserveHost On | ||
57 | ProxyPass /xwiki http://localhost:8080/xwiki nocanon | ||
58 | ProxyPassReverse /xwiki http://localhost:8080/xwiki | ||
59 | |||
60 | ## Workaround for https://bz.apache.org/bugzilla/show_bug.cgi?id=58001 (ProxyPreserveHost does not includes Forwarded) | ||
61 | RequestHeader set Forwarded "proto=https" | ||
62 | |||
63 | # TODO: add your SSL setup | ||
64 | </VirtualHost> | ||
65 | {{/code}} |