Wiki source code of Setting up the Apache HTTP Server Proxy
Version 9.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 | {{code}} | ||
23 | <VirtualHost *:80> | ||
24 | ServerName mydomain.com | ||
25 | ServerAlias *.mydomain.com | ||
26 | |||
27 | RewriteEngine On | ||
28 | RewriteCond %{HTTPS} off | ||
29 | RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L] | ||
30 | </VirtualHost> | ||
31 | |||
32 | <VirtualHost *:443> | ||
33 | ServerName mydomain.com | ||
34 | ServerAlias *.mydomain.com | ||
35 | |||
36 | DocumentRoot /var/www/ | ||
37 | |||
38 | ErrorLog /var/log/apache2/xwiki-error.log | ||
39 | CustomLog /var/log/apache2/xwiki-access.log combined | ||
40 | |||
41 | RedirectMatch ^/$ /xwiki/ | ||
42 | |||
43 | <Location /xwiki> | ||
44 | Order Deny,Allow | ||
45 | Satisfy Any | ||
46 | </Location> | ||
47 | |||
48 | AllowEncodedSlashes NoDecode | ||
49 | |||
50 | ProxyRequests Off | ||
51 | <Proxy *> | ||
52 | Order deny,allow | ||
53 | Allow from all | ||
54 | </Proxy> | ||
55 | ProxyPreserveHost On | ||
56 | ProxyPass /xwiki http://localhost:8080/xwiki nocanon | ||
57 | ProxyPassReverse /xwiki http://localhost:8080/xwiki | ||
58 | |||
59 | ## Workaround for https://bz.apache.org/bugzilla/show_bug.cgi?id=58001 (ProxyPreserveHost does not includes Forwarded) | ||
60 | RequestHeader set Forwarded "proto=https" | ||
61 | |||
62 | # TODO: add your SSL setup | ||
63 | </VirtualHost> | ||
64 | {{/code}} |