# HG changeset patch
# User Menel <menel@mailbox.de>
# Date 1718296208 -7200
#      Thu Jun 13 18:30:08 2024 +0200
# Node ID 37ca0006e817d6063daac377c9a90c7f6d105871
# Parent  336224f0d1e3c0d3230243ee3b1276aa9886a71e
doc/http add real world example at the end to clarify the settings.

diff -r 336224f0d1e3 -r 37ca0006e817 doc/http.md
--- a/doc/http.md	Sat Jun 01 17:26:32 2024 +0200
+++ b/doc/http.md	Thu Jun 13 18:30:08 2024 +0200
@@ -278,28 +278,6 @@
 path, see examples for [BOSH](/doc/setting_up_bosh) and
 [WebSockets](/doc/websocket).
 
-### Apache
-
-See
-[mod_proxy](https://httpd.apache.org/docs/current/mod/mod_proxy.html).
-Firstly, ensure you have the correct modules enabled in Apache:
-
-``` code
-a2enmod proxy
-a2enmod proxy_http
-```
-
-This example assumes your VirutalHost is named "example.com" and you did
-not change the default http port. Then in the Apache config file for
-your domain, add the following lines:
-
-``` code
-RequestHeader set Host "example.com" #set to your prosody http_host, only necessary if it is different from the Apache2 ServerName.
-ProxyPreserveHost On
-ProxyPass / "http://127.0.0.1:5280/"
-ProxyPassReverse / "http://127.0.0.1:5280/"
-```
-
 ### Nginx
 
 ``` code
@@ -337,3 +315,72 @@
 
 HTTP modules such as mod\_bosh must be loaded explicitly here as global
 modules are not loaded onto components by default.
+
+### Apache2 full example
+
+See
+[mod_proxy](https://httpd.apache.org/docs/current/mod/mod_proxy.html).
+Firstly, ensure you have the correct modules enabled in Apache:
+
+``` code
+a2enmod proxy
+a2enmod proxy_http
+```
+
+To clarify the http settings, this example assumes you want to proxy your 
+mod_http_file_share compoment as a whole and proxy only the bosh and websocket paths 
+from your VirrtualHost. Your prosody VirutalHost is named "example.com",
+the upload compoment is named "share.example.com" and your Website is "www.example.com".
+You did not change the default http port. Then in the Apache config file for
+your domain, add the following lines:
+
+``` code
+<VirtualHost *:443>
+ServerName www.example.com
+	SSLEngine On
+  SSLCertificateFile /path/to/certificatefolder/fullchain.pem
+  SSLCertificateKeyFile /path/to/certificatefolder/privkey.pem
+	#set RequestHeader to your prosody http_host, necessary if it is different from the ServerName.
+	RequestHeader set Host "example.com" 
+  RequestHeader set X-Forwarded-Proto: https
+  ProxyPreserveHost On
+
+	ProxyPass / "http://127.0.0.1:5280/xmpp-websocket" upgrade=websocket timeout=900
+
+	ProxyPass / "http://127.0.0.1:5280/http-bind" #for bosh
+	ProxyPassReverse / "http://127.0.0.1:5280/"
+<VirtualHost />
+
+<VirtualHost *:443>
+	ServerName share.example.com
+	SSLEngine On
+  SSLCertificateFile /path/to/certificatefolder/fullchain.pem
+  SSLCertificateKeyFile /path/to/certificatefolder/privkey.pem
+
+  ProxyPreserveHost On
+  RequestHeader set X-Forwarded-Proto: https
+ #here the RequestHederHost is already the same as the Component name.
+	ProxyPreserveHost On
+	ProxyPass / "http://127.0.0.1:5280/"
+	ProxyPassReverse / "http://127.0.0.1:5280/"
+<VirtualHost />
+
+```
+
+In the prosody.cfg.lua you would have globally loaded mod_websocket and mod_bosh.
+Your settings after the global section could look like this:
+
+``` {.code .lua}
+VirtualHost "example.com"
+--... optional unrelated settings ...
+
+Component "share.example.com" "http_file_share"
+  modules_disabled = { "s2s"; } -- its not nessesary to have it loaded here
+  http_file_share_size_limit = 1024*1024*100 --100MB
+  http_file_share_expires_after = "2 weeks"
+  http_external_url = "https://share.example.com/" --nessesary to be the same as the apache host
+  http_paths = {
+    file_share = "/"; -- From the base URL
+ } --here you see how we can manipulate the path for every module like this.
+
+```
