Skip to content

Reverse Proxy Setup

Florian Quirin edited this page Jan 10, 2020 · 15 revisions

Reverse Proxy Setup

-- UNDER CONSTRUCTION --

What is a reverse proxy and why do I need one?

A reverse proxy is lightweight server that acts as a central contact point for clients and distributes connection requests to any number of associated servers that are usually not accessible by a client. In addition it usually offers security features like rate-limiting or handling of SSL certificates.
SEPIA for example requires a reverse proxy if you want to access it safely from a public domain (e.g. example.com/sepia).

Popular reverse proxies and setups for SEPIA

Apache

Create a new file at /etc/apache2/sites-available/sepia.conf and add the following content:

Define LOCATION sepia/assist/app
Define LOCATION sepia
Define HOST localhost

ProxyPass /${LOCATION}/assist/ http://${HOST}:20721/
ProxyPass /${LOCATION}/teach/ http://${HOST}:20722/

<Location /${LOCATION}/chat/>
  ProxyPass http://${HOST}:20723/

  RewriteEngine On
  RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
  RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]
  RewriteRule /messages/(.*) ws://${HOST}:20723/messages/$1 [P]
</Location>

Then load the new settings and restart your Apache web-server:

sudo a2ensite sepia.conf
sudo systemctl reload apache2

Clone this wiki locally