aboutsummaryrefslogtreecommitdiffstats
path: root/docs/content
diff options
context:
space:
mode:
authorKane <61651662+yarg-kane@users.noreply.github.com>2021-10-24 17:48:26 +0200
committerGitHub <noreply@github.com>2021-10-24 17:48:26 +0200
commit932780c2bbae09f052e2fcd1a0701966483496e8 (patch)
tree0f2427091f0b8344ed34db49261cd889afe45be8 /docs/content
parent07c7100c6089a24dcbf1689a5b3bdf04f2471c12 (diff)
downloadgitea-932780c2bbae09f052e2fcd1a0701966483496e8.tar.gz
gitea-932780c2bbae09f052e2fcd1a0701966483496e8.zip
Add HAProxy Config to reverse-proxies.en-us.md (#17407)
* Update reverse-proxies.en-us.md Addition of HAProxy * Update reverse-proxies.en-us.md
Diffstat (limited to 'docs/content')
-rw-r--r--docs/content/doc/usage/reverse-proxies.en-us.md47
1 files changed, 47 insertions, 0 deletions
diff --git a/docs/content/doc/usage/reverse-proxies.en-us.md b/docs/content/doc/usage/reverse-proxies.en-us.md
index 9a2552b711..72998609d9 100644
--- a/docs/content/doc/usage/reverse-proxies.en-us.md
+++ b/docs/content/doc/usage/reverse-proxies.en-us.md
@@ -292,3 +292,50 @@ If you wish to run Gitea with IIS. You will need to setup IIS with URL Rewrite a
</system.webServer>
</configuration>
```
+
+## HAProxy
+
+If you want HAProxy to serve your Gitea instance, you can add the following to your HAProxy configuration
+
+add an acl in the frontend section to redirect calls to gitea.example.com to the correct backend
+```
+frontend http-in
+ ...
+ acl acl_gitea hdr(host) -i gitea.example.com
+ use_backend gitea if acl_gitea
+ ...
+```
+
+add the previously defined backend section
+```
+backend gitea
+ server localhost:3000 check
+```
+
+If you redirect the http content to https, the configuration work the same way, just remember that the connexion between HAProxy and Gitea will be done via http so you do not have to enable https in Gitea's configuration.
+
+## HAProxy with a sub-path
+
+In case you already have a site, and you want Gitea to share the domain name, you can setup HAProxy to serve Gitea under a sub-path by adding the following to you HAProxy configuration:
+
+```
+frontend http-in
+ ...
+ acl acl_gitea path_beg /gitea
+ use_backend gitea if acl_gitea
+ ...
+```
+
+With that configuration http://example.com/gitea/ will redirect to your Gitea instance.
+
+then for the backend section
+```
+backend gitea
+ http-request replace-path /gitea\/?(.*) \/\1
+ server localhost:3000 check
+```
+
+The added http-request will automatically add a trailing slash if needed and internally remove /gitea from the path to allow it to work correctly with Gitea by setting properly http://example.com/gitea as the root.
+
+Then you **MUST** set something like `[server] ROOT_URL = http://example.com/gitea/` correctly in your configuration.
+