httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Giovanni Gherdovich <g.gherdov...@gmail.com>
Subject [users@httpd] can't make reverse proxy rewrite relative links
Date Sun, 29 Sep 2013 09:16:18 GMT
Hello.

I am testing my understanding of reverse proxies
with a toy example on my laptop,
which I am failing at making it work.

On my laptop (host) I run a virtual machine (guest).
Both host and guest have apache 2.2 running.

The host accesses guest's document root pointing
the browser to http://localhost:8080/.
My goal is to use mod_proxy to make the guest content
accessible from host at http://localhost/foo/.

The problem that I observe is that relative links
on pages served by the guest (eg: b/b.html)
aren't translated (eg: foo/b/b.html), and I get a 404.
I am good at getting http://localhost/foo/a.html and
http://localhost/foo/b/b.html if I go directly there,
but the relative link inside those pages aren't mapped
to the host "name-space".

Please find below relevant snippets of my config
and files and loaded modules.

Regards,
GGhh


CONTENT SERVED BY THE GUEST:
============================================
root@precise-server:/var/www# tree
.
├── a.html
└── b
    └── b.html

1 directory, 2 files

root@precise-server:/var/www# cat a.html
<html>
  <body>
    <h1>Hello, World!</h1>
    <a href="/b/b.html">other page</a>
  </body>
</html>

root@precise-server:/var/www# cat b/b.html
<html>
  <body>
    <h1>Hello, World Again!</h1>
    <a href="/a.html">back</a>
  </body>
</html>
==========================================

THE HOST CONFIG:
==========================================
[...]
ProxyRequests off
ProxyPass /foo http://localhost:8080
ProxyPassReverse /foo http://localhost:8080
ProxyHTMLURLMap  /      /foo/
==========================================

MODULES AND VERSION:
==========================================
# apachectl -M
[...]
 proxy_module (shared)
 proxy_html_module (shared)
 proxy_http_module (shared)
[...]


# apache2 -v
Server version: Apache/2.2.22 (Ubuntu)
Server built:   Jul 12 2013 13:19:21
==========================================

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message