DevHeads.net

css files not loading

Hello,
I am hoping to get some help with an issue concerning a reverse proxy
setup and static files.

I have two domains that I purchased from Google Domains, johndavidhock.net
and johndavidhock.com and have created very simple websites for both of the
domains which consist of a single html file and a css file, index.html and
main.css respectively.

My home network is setup as follows:
Server location: 192.168.1.103 - hosts the <a href="http://www.johndavidhock.net" title="www.johndavidhock.net">www.johndavidhock.net</a> site
Server location: 192.168.1.104 - host the <a href="http://www.johndavidhock.com" title="www.johndavidhock.com">www.johndavidhock.com</a> site

I also have a server at 192.168.1.105 which acts as a reverse proxy server
and has the following files in the /etc/apache2/sites-available folder:
Reverse Proxy Server location: 192.168.1.105

johndavidhock.com.conf
johndavidhock.net.conf

The contents are as follows:

<VirtualHost *:80>
ServerName johndavidhock.com
ServerAlias <a href="http://www.johndavidhock.com" title="www.johndavidhock.com">www.johndavidhock.com</a>
ProxyPreserveHost on
ProxyPass / <a href="http://192.168.1.104" title="http://192.168.1.104">http://192.168.1.104</a>
ProxyPass Reverse / <a href="http://192.168.1.104" title="http://192.168.1.104">http://192.168.1.104</a>
</VirtualHost>

<VirtualHost *:80>
ServerName johndavidhock.net
ServerAlias <a href="http://www.johndavidhock.net" title="www.johndavidhock.net">www.johndavidhock.net</a>
ProxyPreserveHost on
ProxyPass / <a href="http://192.168.1.103" title="http://192.168.1.103">http://192.168.1.103</a>
ProxyPass Reverse / <a href="http://192.168.1.103" title="http://192.168.1.103">http://192.168.1.103</a>
</VirtualHost>

The reverse proxy is working in that I am able to access both websites when
I am at a mall, for example, and using their wifi. The issue that I am
having is that the css files are not being picked up. In google developer
tools I am getting a 502 error for the css files.
Please not that I am not very technically savvy about Apache and have
learned most of what I know from watching youtube videos. Also, these
servers are raspberry pi 3+ minicomputers. I have asked for help on the
raspberry pi forums but they directed me to here.

Is this something you can assist with?

Thanks very much,

Dave Hock

Comments

Re: css files not loading

By Frank Gingras at 06/10/2019 - 07:54

Always match the trailing slashes when using the ProxyPass directive.
The ProxyPassReverse should match too.

On 09/06/19 10:15 PM, Dave Hock wrote:

Re: css files not loading

By Dave Hock at 06/10/2019 - 09:09

Hello Frank,
So I tried your suggestion and of course it worked!! I hope you know
how much this means to me. I have been looking for a solution to this for
several months and had given up a couple of times. Thank you so much!!