-
-
Notifications
You must be signed in to change notification settings - Fork 170
External Webserver use: Reverse proxy
Reverse-proxy is a function in some webservers where the connection is passed through to a second webserver. This can be used to host multiple HTTP services on a single machine, or routing http traffic to https since HTTP uses port 80 and HTTPS port 443.
⚠️ Limited support notice⚠️
If things on this tutorial don't work for you, consult documentation of your webserver. Very limited support will be provided on discord for configuration issues of reverse-proxies.There is a debugging checklist at the bottom of this article to help you figure out where the issue is when you're setting up.
Following example routes traffic from http to https and utilizes a reverse-proxy (proxy_pass
) to direct traffic to the Plan webserver.
server {
listen 80;
server_name plan.example.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
ssl on;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
server_name plan.example.com;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://127.0.0.1:8804;
}
}
Note that this example has installed a certificate with certbot. See HTTPS set up tutorial. It is rather painless to install certificate on nginx after it has been set up.
After installing HTTPS on the nginx, you can set up proxy settings for Plan
Credit to Benji for this:
ProxyPass /plan/ http://0.0.0.0:8804/
ProxyPassReverse /plan/ http://0.0.0.0:8804/
Make sure to replace 0.0.0.0:8804 with your server's ip and Plan port
Note that this puts it in a subdirectory, if you want it in the main folder just change /plan/
to /
Some instructions
- Enable the needed modules with
a2enmod proxy proxy_http
- Restart the apache webserver
After installing HTTPS on the Apache, you can set up proxy settings for Plan
- Check that Plan webserver has enabled (on the server console)
- Check that you can access the Plan webserver on the local machine (something like
curl http://127.0.0.1:8804
), if you can't it's likely that your server is in a container (like docker) and the port is not exposed. - Check that you can access the nginx/apache webserver by going to
http://<server_ip>
on the browser. If you're redirected or shown a page you can access. - Check that
Webserver.Alternative_IP
settings in Plan point to the address you put as the reverse-proxyserver_name
or location. (For exampleplan.example.com
orexample.com/plan
) - Check that your DNS A-record is routed properly with
ping example.domain.com
(Look that the output has server ip somewhere)- If you are using something like Cloudflare, I can't help you, ask them or their documentation.
- Check that you nginx configuration does not have some
*
server_name or location that redirects all traffic elsewhere (In these cases you're redirected to wrong place lot of the time)