can't make reverse proxy rewrite relative links

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx






[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux