Forum archive
Avideo behind a Apache Proxy
Hi,
I am using apache proxy to manage traffic from only 1 public ip, to local ip assigned servers. Also certbot/letsencrypt is working on this proxy.
External Firewall is natting all traffic on ports 80 and 443 to this proxys internal ip.
Everything works well, except for that all my local servers are listening on port 80. So configuration on proxy with apache en lets encrypt take care of my pages are being seen as https.
My problem is that is the first time I install Avideo wich is coming full working on 443 and with own local encryption.
Have try multiple configurations but only got errors. How should I configure Apache proxy and Certbot in that case.
Thanks in advance,
CC

A little research reveals that Avideo doesn't "officially" support running behind a reverse proxy and the dev doesn't seem to have any interest in actively supporting it or even assisting those that want to. That's a bit of a pity as a server behind a reverse proxy is pretty common these days. So whilst initially your results (broken but vaguely working site) were not what I expected, in light of the above, it seems somewhat expected.
Having said that, my suspicion is that it's still possible, it's just a matter of working out exactly which Apache config is required (on your reverse proxy). So hopefully we can still get it to work.
Before I go any further, thanks for asking about "adding a hosts entry". Apologies that I just glossed over that. It's a curse of knowledge issue (it seems so obvious and intuitive to me, that I forget that it's not knowledge that most people have). In case you haven't already noticed, my default is to either gloss over stuff, or dive in really deep (i.e. too shallow or too deep; nothing in between). But I'll try to not go too far down the rabbit hole. If you need more details/explanation, please do not hesitate to ask ask. If you have the question, then it's almost certain that other have the same question!
Adding an entry to your hosts file is essentially a way to resolve a domain without needing to configure DNS.
On Linux, you'll find it at /etc/hosts and by default, it looks like this (at least on TurnKey):
127.0.0.1 localhost 127.0.1.1 HOSTNAME #Required for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhostsWhere HOSTNAME is the hostname of your system. Assuming that your reverse proxy isn't a TurnKey system, then it may look a little different but should be somewhat similar and should at the very least have the first line (so 'localhost' can be resolved). Note that as is quite common on Linux, lines that start with '#' are considered "comments" and are ignored (so useful for adding additional info and reminders for future you).
To add a hosts entry, simply add a new line in the same format. I.e. IP address, space(s) (or tab(s) - aka "white space separated") and then domain. You can also add a (white space separated) short name as well if you wish, but for your purposes, it's not required and probably doesn't add any value. Regarding formatting, I personally like to keep the IPv4 addresses together, so I add new entries below the '127.0.1.1 HOSTNAME', before the commented line re IPv6 - but I'm 99% sure that you could add an IPv4 at the end if you want.
To be explicit, here is an example hosts entry for 'www.example.com' that points to 192.168.1.100:
Simple as that. To double check that it worked, try pinging it. As you can see, I get an error as I don't have a computer using 192.168.1.100 - but it demonstrates that www.example.com maps to 192.168.1.100 (FYI 192.168.1.158 is my PC):
So if you want to try that path again, you can give that a go. Having said that, my suspicion is that that still won't be enough to resolve your current issues (see my comment above about Avideo reverse proxy support). I suspect that you may still have issues with the reverse proxy. But perhaps I'm wrong?
Re the missing assets, my guess is that they are not being mapped properly to where they "really" are. The lack of styling suggests that CSS files aren't being served from a URL that Avideo expects. So first thing I recommend, is clearing your web browser cache and cookies for your Avideo site. Also if you have any caching configured in your reverse proxy, clear those caches too (if unsure, just manually restarting your Apache reverse proxy server should do that).
Assuming that doesn't just fix it, to work out what might be going on, you'll need to check if my suspicion is correct. To do that open "web developer tools" in your web browser and look for any errors there. How you do that will depend on your web browser (and possibly OS), but on Firefox (at least on Linux); click the "hamburger" icon >> More Tools >> Web Developer Tools (or Shift-Ctrl-i). I suggest focusing on 404 errors as that will likely be related to missing resources that the page expects, but aren't being served. Any 50x errors are also worth noting too. At this point, I'd recommend not focussing on javascript errors. They may be related, but often are just "noise".
Also FWIW, I did come across an Apache reverse proxy config that might be of value. TBH, I'm not sure, but it may give you some things to test?
<VirtualHost *:443> ServerName video.example.com SSLEngine On SSLProxyEngine On SSLProxyVerify none SSLProxyCheckPeerCN Off SSLProxyCheckPeerName Off SSLCertificateFile /local/path/to/letsencrypt/video.example.com.cer SSLCertificateKeyFile /local/path/to/letsencrypt/video.example.com.key RequestHeader set X-Forwarded-Proto expr=%{REQUEST_SCHEME} ProxyVia On ProxyRequests Off ProxyPreserveHost On <Proxy *> Options FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all ProxyPass / https://192.168.1.100/ ProxyPassReverse / https://192.168.1.100/ </VirtualHost>Good luck and I hope that helps. If not, please post back with what happens and we'll try some more. If I get a chance, I may even try setting one up myself.