1

Is it possible for a RPi server to serve from another RPi on the same network?

I have 2 RPi's on my home network, both running apache servers - Raspberry A is linked to a web domain i.e. mydomain.net, and the router redirects incoming http/https calls to it; Raspberry B is only available inside the network at network IP 192.168.1.123. If possible I'd like to create a html/php page on Raspberry A that relays calls to/from Raspberry B's network IP. Grateful for any advice on how to achieve this.

geotheory
  • 575
  • 3
  • 10
  • 19
  • IHMO - no simple way -try to read this... https://docs.trafficserver.apache.org/en/4.2.x/admin/reverse-proxy-http-redirects.en.html However, I would create a simple python webserver on B that - each call - would make a call to A and copied the response. – jaromrax Feb 06 '17 at 16:54

1 Answers1

1

You are talking about a reverse proxy. The apache docs explain it in detail here : https://httpd.apache.org/docs/2.4/howto/reverse_proxy.html

Essentially, you need mod_proxy enabled and then you can use the ProxyPass directive.

Example (from the docs):

ProxyPass "/images" "http://www.example.com/" ProxyPassReverse "/images" "http://www.example.com/"

In the above, any requests which start with the /images path with be proxied to the specified backend, otherwise it will be handled locally.

Note: The ProxyPassReverse is used to make sure that the displayed URLs that make it back to the client are for the proxy not the (unreachable directly) back end server.

KennetRunner
  • 1,050
  • 7
  • 13
  • Just picking this up again. The guidance seems to leave quite a bit inferred. Where is this example supposed to go - /etc/apache2/apache2.conf? Inside directory tags? Do I need to create a directory in web path to link the setting to? Does it need to include anything? I'm probably over-complicating it, but this documentation does seem light.. – geotheory Feb 22 '17 at 01:35
  • In sites-available/default (or the .conf file for the particular site, if you're hosting multiple) inside the element create a element and add the two directive above inside that. – KennetRunner Feb 22 '17 at 08:59