You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Todd Nine <to...@gmail.com> on 2006/11/25 02:11:24 UTC

[users@httpd] Help with mod_proxy

Hi all,
  I'm using mod_proxy and I am having some issues.  I have several VMWare
images that will be used for development and testing, I want the instance to
be served via a single Apache server.  I can then just display a nice error
that we're currently maintaining a system when we bring it down.  I'm
putting each virtual host in it's own .conf file in the conf.d directory.  A
.conf file looks like this.

LoadModule proxy_module mod_proxy.so
LoadModule proxy_http_module mod_proxy_http.so

# Put this with your other VirtualHosts, or at the bottom of the file
<VirtualHost *>
    ServerName gforge.mydomain.com

    ProxyRequests Off
    ProxyPreserveHost On

    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>

    ProxyPass / http://192.168.221.101/
    ProxyPassReverse / http://192.168.221.101/

    <Location />
        Order allow,deny
        Allow from all
    </Location>


</VirtualHost>

Now, I am having a problem, and have a question.  First if all of the
servers I am connecting to via the proxy server are not running, all of the
virtual hosts that I'm proxying fail with the following error message for
every back end server that's not running.  This seems to cause all proxying
to fail.

[Fri Nov 24 14:07:26 2006] [error] (113)No route to host: proxy: HTTP:
attempt to connect to 192.168.221.102:80 (192.168.221.102) failed

How can I set up the virtual host proxy to not cause an error if it cannot
connect to the back end server?  Second, how can I set up a default "the
server is under maintenance" page with the host name in it?  Where would I
find this documentation?  I've been digging though Apache's site and
Google's returned examples, but I can't seem to find anything that gives me
a concrete example.

Thanks,
Todd

[users@httpd] Re: Help with mod_proxy

Posted by paul <pa...@subsignal.org>.
Todd Nine schrieb:
 I have another question on the efficiency
> side.  I'd like to use domain name for ease of configuration, however I
> know
> it is less efficient than using IP.  Is it less efficient for the first
> proxy request (IE does apache cache the IP after the first lookup?), or
> does it look up the server every time?
I can't answer this for sure but it seems lookups are not cached by
apache. However the client (XP, linux) does cache lookups. The cachetime
for positive lookups on XP is rather high (24 hours or so). If you don't
need the added flexibility of dns names, IPs are fine. If that really
makes a difference wrt performance I don't know.

cheers
 Paul


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: Help with mod_proxy

Posted by Todd Nine <to...@gmail.com>.
Thanks for getting back to me Paul.  Sorry I snapped at you, it was uncalled
for, it has been one of those weekends ... :).  I finally figured out my
issue, and unfortunately, it was a bonehead move on my part.  As I said
earlier, I've defined each virtual host in its own .conf file so editing
each one is easy to do.  Unfortunately, I forgot to add the following
directive to the main httpd.conf file.

NameVirtualHost *

Its such a simple directive, yet affects so much...  Thanks for all the
help, the examples were helpful.  I have another question on the efficiency
side.  I'd like to use domain name for ease of configuration, however I know
it is less efficient than using IP.  Is it less efficient for the first
proxy request (IE does apache cache the IP after the first lookup?), or does
it look up the server every time?

Thanks

Todd

On 11/25/06, paul <pa...@subsignal.org> wrote:
>
> forgot to mention: this is apache-2.2.3 on linux.
>
> cheers
> Paul
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

[users@httpd] Re: Help with mod_proxy

Posted by paul <pa...@subsignal.org>.
forgot to mention: this is apache-2.2.3 on linux.

cheers
 Paul


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: Help with mod_proxy

Posted by paul <pa...@subsignal.org>.
Todd Nine schrieb:
> No you misunderstood my post.  I'm not an idiot, I understand the point of
> proxying,  if the target server is down I won't be able to connect.
Sorry I didn't meant to be rude...

  Here's
> a more clear example.  I'm proxying 2 http servers, server A and server B.
> If server B is not running when the proxy starts, I can't connect to server
> A.  I receive this message in the browser
Eather my english is quite broken or this is quite different from your
first explanation.

Nitpicking aside, I tried to reproduce your error, but it's working fine
here:

VirtualHost *:80>
	ServerName proxytest.test.home
	ServerAdmin admin@proxytest.test.home
	DocumentRoot "/var/www/localhost/htdocs"
	Header set Server "apache on gentoo."

	<IfDefine PROXY>	
		ProxyPass / http://oh_look.no.such.host/
		ProxyPassReverse / http://oh_look.no.such.host/
	</IfDefine>
</VirtualHost>

<VirtualHost *:80>
	ServerName projects.test.home
	ServerAdmin admin@projects.test.home
	DocumentRoot "/var/www/localhost/htdocs"
	Header set Server "apache on gentoo."

	<IfDefine PROXY>	
		ProxyPass / http://localhost:8000/
		ProxyPassReverse / http://localhost:8000/
	</IfDefine>
</VirtualHost>

Now http://projects.test.home shows my trac projects and
proxytest.test.home gives 502 proxy error:

Proxy Error

The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /.

Reason: DNS lookup failure for: oh_look.no.such.host
Apache Server at proxytest.test.home Port 80


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Help in setting up file Upload Feature with Apache

Posted by Emmanuel E <em...@gmx.net>.
it depends on how feature rich you want the interface to be. you can pick up the very simple perl CGI script at http://www.geniegate.com/listings/basicupload/ its free source with a compulsory banner. you could check it out and write your own. i've hacked it to include a download feature as well. if you need that let me know. 

note: there is no password protection or size limit. you might run it on a ssl server with basic auth enabled.
  ----- Original Message ----- 
  From: Todd Nine 
  To: users@httpd.apache.org 
  Sent: Saturday, November 25, 2006 10:27 PM
  Subject: Re: [users@httpd] Help in setting up file Upload Feature with Apache


  Exactly, with you'll want to take into account the file size as well.  There is a limit on the upload file size you will need to set on the server, for my uses, I usually use around 10 Mb.

  Todd


  On 11/25/06, Stephen <st...@rogers.com> wrote:
    David wrote:
    > hi guys,
    >
    > I am trying to set up a file upload feature using my apache server. I
    > want a particular page on my website to allow users to upload files to
    > my server.
    > 
    > Anyone can help or provide any pointers on how to do this ?
    You need to create a web page with a form and a script in PHP or CGI to
    handle the action of the form.

    Stephen


    --------------------------------------------------------------------- 
    The official User-To-User support forum of the Apache HTTP Server Project.
    See <URL:http://httpd.apache.org/userslist.html> for more info.
    To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
       "   from the digest: users-digest-unsubscribe@httpd.apache.org 
    For additional commands, e-mail: users-help@httpd.apache.org




Re: [users@httpd] Help in setting up file Upload Feature with Apache

Posted by Todd Nine <to...@gmail.com>.
Exactly, with you'll want to take into account the file size as well.  There
is a limit on the upload file size you will need to set on the server, for
my uses, I usually use around 10 Mb.

Todd

On 11/25/06, Stephen <st...@rogers.com> wrote:
>
> David wrote:
> > hi guys,
> >
> > I am trying to set up a file upload feature using my apache server. I
> > want a particular page on my website to allow users to upload files to
> > my server.
> >
> > Anyone can help or provide any pointers on how to do this ?
> You need to create a web page with a form and a script in PHP or CGI to
> handle the action of the form.
>
> Stephen
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

Re: [users@httpd] Help in setting up file Upload Feature with Apache

Posted by Stephen <st...@rogers.com>.
David wrote:
> hi guys,
>  
> I am trying to set up a file upload feature using my apache server. I 
> want a particular page on my website to allow users to upload files to 
> my server.
>  
> Anyone can help or provide any pointers on how to do this ?
You need to create a web page with a form and a script in PHP or CGI to 
handle the action of the form.

Stephen


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Help in setting up file Upload Feature with Apache

Posted by David <am...@starhub.net.sg>.
hi guys,
 
I am trying to set up a file upload feature using my apache server. I
want a particular page on my website to allow users to upload files to
my server. 
 
Anyone can help or provide any pointers on how to do this ?
 
 
Please note  <ma...@starhub.net.sg> amdawong@starhub.net.sg
will not be in use anymore. Please kindly update my email address to
<ma...@gmail.com> fookheng@gmail.com
 

 


Re: [users@httpd] Re: Help with mod_proxy

Posted by Todd Nine <to...@gmail.com>.
No you misunderstood my post.  I'm not an idiot, I understand the point of
proxying,  if the target server is down I won't be able to connect.  Here's
a more clear example.  I'm proxying 2 http servers, server A and server B.
If server B is not running when the proxy starts, I can't connect to server
A.  I receive this message in the browser

Bad Gateway The proxy server received an invalid response from an upstream
server.


as well as the error in the log I posted previously, but its not an error
for the host I'm requesting with the browser!  Its not clear to my why the
proxy virtual hosts are not independent of each other.  Is there another
configuration directive I need?

Todd

On 11/25/06, paul <pa...@subsignal.org> wrote:
>
> Todd Nine schrieb:
> [snip]
>
> > Now, I am having a problem, and have a question.  First if all of the
> > servers I am connecting to via the proxy server are not running, all of
> the
> > virtual hosts that I'm proxying fail with the following error message
> for
> > every back end server that's not running.  This seems to cause all
> proxying
> > to fail.
> Wait, you're saying if the backend is down proxying fails? What a
> surprise...
>
> >
> > [Fri Nov 24 14:07:26 2006] [error] (113)No route to host: proxy: HTTP:
> > attempt to connect to 192.168.221.102:80 (192.168.221.102) failed
> >
> > How can I set up the virtual host proxy to not cause an error if it
> cannot
> > connect to the back end server?  Second, how can I set up a default "the
> > server is under maintenance" page with the host name in it?
> I get a proxy error with a HTTP error code (cannot remember offhand). It
> should be possible to set up a custom error page to catch that.
>
> cheers
> Paul
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

[users@httpd] Re: Help with mod_proxy

Posted by paul <pa...@subsignal.org>.
Todd Nine schrieb:
[snip]

> Now, I am having a problem, and have a question.  First if all of the
> servers I am connecting to via the proxy server are not running, all of the
> virtual hosts that I'm proxying fail with the following error message for
> every back end server that's not running.  This seems to cause all proxying
> to fail.
Wait, you're saying if the backend is down proxying fails? What a
surprise...

> 
> [Fri Nov 24 14:07:26 2006] [error] (113)No route to host: proxy: HTTP:
> attempt to connect to 192.168.221.102:80 (192.168.221.102) failed
> 
> How can I set up the virtual host proxy to not cause an error if it cannot
> connect to the back end server?  Second, how can I set up a default "the
> server is under maintenance" page with the host name in it? 
I get a proxy error with a HTTP error code (cannot remember offhand). It
should be possible to set up a custom error page to catch that.

cheers
 Paul


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org