Welcome to HostingForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Newbie's Reverse Proxy problem

 
   Web Hosting Problem Solving Community! (Home) -> Apache RSS
Next:  apache 2.046 win McAfee  
Author Message
user2648

External


Since: Jan 20, 2004
Posts: 2



(Msg. 1) Posted: Wed Jan 21, 2004 12:43 am
Post subject: Newbie's Reverse Proxy problem
Archived from groups: alt>apache>configuration (more info?)

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>

(...)

 >> Stay informed about: Newbie's Reverse Proxy problem 
Back to top
Login to vote
davideyeahsure

External


Since: Nov 03, 2003
Posts: 2994



(Msg. 2) Posted: Wed Jan 21, 2004 9:19 am
Post subject: Re: Newbie's Reverse Proxy problem [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Guido Purper <gpu001-nospam.RemoveThis@expires-2003-12-31.arcornews.de> wrote:
 > So, the core proxy works, but the path of links is not build correctly (the
 > "/m01/" is missing)

The path isn't touched by the proxy, only the referrer and other stuff
in the header of the request are touched. If your page contains a
link to /something/ in the html code, it will be left untouched.

 > Am I missing something? What is wrong?

Nothing, this is how the proxy works. If you can't have the
application referring to himself as /m01/ it won't work.

Davide

--
| "Lotus Notes for Dummies" is surely a single page pull out with
| "don't" printed on it. --Unknown
|
|
|
|<!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: Newbie's Reverse Proxy problem 
Back to top
Login to vote
user2651

External


Since: Jan 21, 2004
Posts: 1



(Msg. 3) Posted: Wed Jan 21, 2004 5:49 pm
Post subject: Re: Newbie's Reverse Proxy problem [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Davide Bianchi <davideyeahsure.TakeThisOut@onlyforfun.net> wrote:

 > Guido Purper <gpu001-nospam.TakeThisOut@expires-2003-12-31.arcornews.de> wrote:
  > > So, the core proxy works, but the path of links is not build correctly (the
  > > "/m01/" is missing)
 >
 > The path isn't touched by the proxy, only the referrer and other stuff
 > in the header of the request are touched. If your page contains a
 > link to /something/ in the html code, it will be left untouched.
 >
  > > Am I missing something? What is wrong?
 >
 > Nothing, this is how the proxy works. If you can't have the
 > application referring to himself as /m01/ it won't work.

Although you could stick a Rewrite directive in the proxy config to add
it.

Choobs

--
Sir Chewbury Gubbins <chewbury.gubbins.TakeThisOut@nelefa.org>
Knight of the Wholly Gnarly Widget
<a style='text-decoration: underline;' href="http://www.nelefa.org" target="_blank">http://www.nelefa.org</a><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: Newbie's Reverse Proxy problem 
Back to top
Login to vote
davideyeahsure

External


Since: Nov 03, 2003
Posts: 2994



(Msg. 4) Posted: Wed Jan 21, 2004 5:55 pm
Post subject: Re: Newbie's Reverse Proxy problem [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Sir Chewbury Gubbins <chewbury.gubbins.RemoveThis@nelefa.org> wrote:
 > Although you could stick a Rewrite directive in the proxy config to add
 > it.

And how do you distinguish between things on m01 or m02? The request
came for an unspecified images or documents that could be in any of the
two servers...

Davide

--
| My Win98 installation has been doing that for months.. German,
| English, and Dutch, all intermingled. What's so frightening about
| that? -- Jasper Janssen You mean seeing "Reboot Macht Frei" on your
| screen? -- Greg Andrews -- from alt.sysadmin.recovery
|
|<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: Newbie's Reverse Proxy problem 
Back to top
Login to vote
user2648

External


Since: Jan 20, 2004
Posts: 2



(Msg. 5) Posted: Wed Jan 21, 2004 11:28 pm
Post subject: Re: Newbie's Reverse Proxy problem [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Davide Bianchi <davideyeahsure.DeleteThis@onlyforfun.net> wrote:

 >And how do you distinguish between things on m01 or m02? The request
 >came for an unspecified images or documents that could be in any of the
 >two servers...

Hmmm, seems that I will need to try virtual hosts...

Anyway, is what I want so unusual?
How will an Apache-Guru solve this?

Guido<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: Newbie's Reverse Proxy problem 
Back to top
Login to vote
davideyeahsure

External


Since: Nov 03, 2003
Posts: 2994



(Msg. 6) Posted: Wed Jan 21, 2004 11:28 pm
Post subject: Re: Newbie's Reverse Proxy problem [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Guido Purper <gpu001-nospam RemoveThis @expires-2003-12-31.arcornews.de> wrote:
 > How will an Apache-Guru solve this?

There are things that cannot be solved in post-deployment. If the
web application (or website) is broken, there is no way to fix it
in the Apache configuration.

Davide

--
| USER, n.: The word computer professionals use when they mean "idiot."
| --Dave Barry, "Claw Your Way to the Top"<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: Newbie's Reverse Proxy problem 
Back to top
Login to vote
jring

External


Since: Jun 30, 2003
Posts: 154



(Msg. 7) Posted: Fri Jan 23, 2004 2:58 am
Post subject: Re: Newbie's Reverse Proxy problem [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

  > >And how do you distinguish between things on m01 or m02? The request
  > >came for an unspecified images or documents that could be in any of the
  > >two servers...
 >
 > Hmmm, seems that I will need to try virtual hosts...

that'd be a clean solution.

 > Anyway, is what I want so unusual?
 > How will an Apache-Guru solve this?

i don't know how a guru would solve it, probably the solution would
involve a lot of meditation...

but one can use rewrite rules to add the correct url-prefix according
to the referrer.

RewriteCond %{HTTP_REFERER} ^/(site1|site2)
RewriteRule ^(/image.*) /%1$1

this is a very dirty trick and has some caveats but if vhosts are
impossible it might be a way.

joachim<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: Newbie's Reverse Proxy problem 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
ftp proxy reverse - Hello! Some one can help me about Ftp proxy reverse on Apache 2? Thank you

Reverse Proxy Performance - Hi all, I am experimenting with using Apache as a reverse proxy server. The performance seems very slow. I have added the following into the config as my ProxyPass Listen 10.0.0.60:81 <VirtualHost 10.0.0.60:81> ServerAdmin..

mod_rewrite and reverse proxy ftp - Hello I have 2 problems. First someone can say me how do ftp reverse proxy wtih Apache 2 please. Two i have done http proxy reverse on apache 2 but i would like add rules with mod_rewrite. Mod_rewrite work if i don't use proxy reverse but else it's..

reverse proxy configuration - Hello, I'm using Stronghold 4.0 (Apache 1.3.22) as a reverse ssl proxy with the following configuration: <VirtualHost _default_:443> # General setup for the virtual host #DocumentRoot "/usr/local/stronghold/www/htdocs" #ServerName ww...

reverse proxy + https - Can you help please? Is it possible to configure Apache to act as a reverse proxy (maybe the name is not appropriate) for https traffic? I've been able to set up Apache as reverse proxy (mod_proxy, mod_rewrite) and SSL server (with apache_ssl or mod_ssl...
   Web Hosting Problem Solving Community! (Home) -> Apache All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]