Hi folks,
I am new to Apache and to Linux.
I need to set up a reverse proxy with Apache2 and Linux (Suse 8.2). After
reading manuals and documentation (e.g.
http://httpd.apache.org/docs-2.0/mod/mod_proxy.html) I thought this would be a
pretty easy task - unfortunately it seems that I'm wrong....
After 3 days of try-and-error-and-search I am completely clueless...
What I want appears to me as a standard setup:
- 2 webservers inside the network (m01.mycompany.com, m02.mycompany.com)
- 1 reverse proxy (linux1.mycompany.com) on internet (secured)
The inside servers are mapped into the proxy server's the name-space:
http://linux1.mycompany.invalid/m01/ -->
http://m01.mycompany.invalid/
http://linux1.mycompany.invalid/m02/ -->
http://m02.mycompany.invalid/
I did all according to the reference configuration, however I did encounter a
problem:
When a page is viewd through the Proxy server, links on the root of the
destination are not correct.
The index.html of m01 contains a link to "/subdir/mypage.html".
The HTML code is: <A HREF="/subdir/mypage.html">My Page</A>
(I cannot change the code since it is generated)
The link should appear on the browser as pointing to
"http://linux1.mycompany.invalid/m01/subdir/mypage.html"
but it points to "http://linux1.mycompany.invalid/subdir/mypage.html"
So, the core proxy works, but the path of links is not build correctly (the
"/m01/" is missing)
Please find my config below. I don't want to use virtual hosts for several
reasons. Am I missing something? What is wrong?
Guido
---=== httpd.conf ===---
### Section 1: Global Environment
ServerRoot "/srv/www"
(...)
Listen 80
# === GPu start ==============================================
LoadModule proxy_module /usr/lib/apache2-prefork/mod_proxy.so
LoadModule proxy_connect_module /usr/lib/apache2-prefork/mod_proxy_connect.so
LoadModule proxy_http_module /usr/lib/apache2-prefork/mod_proxy_http.so
ProxyRequests Off
# === GPu end ================================================
(...)
### Section 2: 'Main' server configuration
(...)
User wwwrun
Group nogroup
UseCanonicalName Off
DocumentRoot "/srv/www/htdocs"
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
# === GPu start ==============================================
<Location /m01/>
Options FollowSymLinks
AllowOverride All
ProxyPass
http://m01.mycompany.invalid/
ProxyPassReverse
http://m01.mycompany.invalid/
</Location>
<Location /m02/>
Options FollowSymLinks
AllowOverride All
ProxyPass
http://m02.mycompany.invalid/
ProxyPassReverse
http://m02.mycompany.invalid/
</Location>
# === GPu end ================================================
<Directory proxy:*>
Order Deny,Allow
Deny from all
Allow from all
</Directory>
<Directory "/srv/www/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
(...)
HostnameLookups Off
(...)
# don't know if this is needed
<IfModule mod_proxy.c>
ProxyRequests Off
<Proxy *>
Order deny,allow
# Deny from all
Allow from all
</Proxy>
#ProxyVia On
(...)
</IfModule>
(...)