1

I have a new rasperryPi webserver running raspbian that I'm trying to use to proxy to web-enabled device from FieldServer Tech (fieldserver.com) on our intranet. Inside /etc/apache2/sites-available/default I've added the following line:

 <Location /modbus/>
     ProxyPass http://192.168.10.124/
 </Location>

After restarting the webserver when I try to browse to the defined proxy address

 http://192.168.10.7/modbus/

I get the password prompt from the FieldServer device but after authenticating I get an error indicating the initial page cannot be loaded:

Not Found
The requested URL /app/profiles/profiles.htm was not found on this server.
Apache/2.2.22 (Debian) Server at 192.168.10.7 Port 80

Is there a way I can address this problem from the apache conf or is the problem with the FieldServer device?


More system info:

$ cat /etc/os-release*
PRETTY_NAME="Raspbian GNU/Linux 7 (wheezy)"
NAME="Raspbian GNU/Linux"
VERSION_ID="7"
VERSION="7 (wheezy)"
ID=raspbian

$ dpkg-query -l | grep apache
ii  apache2                               2.2.22-13+deb7u3  
agt24
  • 13
  • 3

1 Answers1

1

I believe you need to add the ProxyPassReverse directive to the apache configuration:

 <Location /modbus/>
     ProxyPass http://192.168.10.124/
     ProxyPassReverse http://192.168.10.124/
 </Location>

This answer has a pretty concise explanation on what ProxyPassReverse does, if you're curious.

Community
  • 1
  • 1
waynethec
  • 529
  • 3
  • 9
  • Thanks for the suggestion. I added this line and restarted apache but the behavior doesn't change. – agt24 Oct 20 '14 at 13:37
  • Does http://192.168.10.7/modbus/app/profiles/profiles.htm bring up a 404? The FieldServer application files should probably be contained within a folder you can proxy like http://192.168.10.124/modbus – waynethec Oct 20 '14 at 14:02
  • (deleted erroneous comment) 192.168.10.7/modbus/app/profiles/profile.htm does not bring up a 404. It brings up a blank page, however when I view source I can see the code from the FieldServer app. I neglected to mention this appears to be a java app. I can share the source code for this page if it would be useful. I'm not sure I understand your suggestion regarding putting the application within a folder. Are you suggesting a second directive in the apache conf? – agt24 Oct 20 '14 at 16:24
  • If you change your existing rule to the one below and access the raspberry pi webserver at the root address, does it work? ` ProxyPass http://192.168.10.124/ ProxyPassReverse http://192.168.10.124/ ` *Edit*: I just saw your edit. It's seems that the directory infrastructure on the Fieldserver app needs to be moved around to accommodate the ProxyPass. When you authenticate via the proxied address, it tries to request files (a tree level) outside of the /modbus address (/app/profiles/profiles.htm) which obviously does not exist on the server. – waynethec Oct 20 '14 at 16:31
  • The solution would be to relocate all files used on the root server of http://192.168.10.124/ into folder '/modbus' so when accessed via ProxyPass, the tree levels are the same. This is why the ProxyPass I gave you in the previous comment will probably work -- the tree level will match http://192.168.10.124/'s. – waynethec Oct 20 '14 at 16:38
  • Thanks, that makes sense. But I don't have terminal access to the FieldServer device -- just the webgui which is very limited. Perhaps a VirtualHost would be a better option to allow me to access the FieldServer device through the Pi? – agt24 Oct 20 '14 at 17:29
  • Confirmed. Adding the lines you've suggested above to a virtual host file allows me to access the FieldServer device through a hostname I setup at DuckDNS.org. My problem is resolved. Thanks for your help. – agt24 Oct 20 '14 at 18:22