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