You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Ben Laurie <be...@algroup.co.uk> on 1998/09/14 14:26:31 UTC

ServerPort directive

The ServerName directive is handy for a variety of reasons, but one in
particular is for use where NAT or load-balancing stuff is between you
and the 'net. However, we ran into a problem recently - where you map IP
addresses on the outside to port numbers on the inside. This works fine
until you hit an internally generated redirect - at which point the port
number gets lost (ServerName preserves the external IP, but the internal
port is used instead of the external one). To fix this problem we
implemented a ServerPort directive, analogous to ServerName. I know I'm
pushing my luck for 1.3.2, but, nevertheless, here it is.

BTW, this patch was sponsored by Virgin Music Group.

Cheers,

Ben.

-- 
Ben Laurie            |Phone: +44 (181) 735 0686| Apache Group member
Freelance Consultant  |Fax:   +44 (181) 735 0689|http://www.apache.org/
and Technical Director|Email: ben@algroup.co.uk |
A.L. Digital Ltd,     |Apache-SSL author     http://www.apache-ssl.org/
London, England.      |"Apache: TDG" http://www.ora.com/catalog/apache/

WE'RE RECRUITING! http://www.aldigital.co.uk/

Re: ServerPort directive

Posted by Ben Laurie <be...@algroup.co.uk>.
Marc Slemko wrote:
> 
> On Tue, 15 Sep 1998, Ben Laurie wrote:
> 
> > Could be! Are you saying I should do something like this:
> >
> > Listen 123
> > <VirtualHost a.b.c.d:123>
> > Port 80
> > ...
> > </VirtualHost>
> >
> > If so, I admit it hadn't occurred to me.
> 
> Sure, if you need a VirtualHost.

Yeah, loads of them. I tested this today. It seems to work.

Cheers,

Ben.

-- 
Ben Laurie            |Phone: +44 (181) 735 0686| Apache Group member
Freelance Consultant  |Fax:   +44 (181) 735 0689|http://www.apache.org/
and Technical Director|Email: ben@algroup.co.uk |
A.L. Digital Ltd,     |Apache-SSL author     http://www.apache-ssl.org/
London, England.      |"Apache: TDG" http://www.ora.com/catalog/apache/

WE'RE RECRUITING! http://www.aldigital.co.uk/

Re: ServerPort directive

Posted by Marc Slemko <ma...@znep.com>.
On Tue, 15 Sep 1998, Ben Laurie wrote:

> Could be! Are you saying I should do something like this:
> 
> Listen 123
> <VirtualHost a.b.c.d:123>
> Port 80
> ...
> </VirtualHost>
> 
> If so, I admit it hadn't occurred to me.

Sure, if you need a VirtualHost.  

If not, a:

Listen 123
Port 80

should do it.  

The way to think of it is that Port never changes how the server actually
listens to things, except in the special case where there are no other
directives (ie. Listen directives) to tell it where to listen.  Aside from
this special case, Port is completely a connection impacting (ie. not
initialization impacting) thing and could actually be done away with, in
the normal case, if UseCanonicalName off was default.

In other words, the Port directive tells the server what port to think it
is listening on.


Re: ServerPort directive

Posted by Ben Laurie <be...@algroup.co.uk>.
Marc Slemko wrote:
> 
> On Mon, 14 Sep 1998, Ben Laurie wrote:
> 
> > The ServerName directive is handy for a variety of reasons, but one in
> > particular is for use where NAT or load-balancing stuff is between you
> > and the 'net. However, we ran into a problem recently - where you map IP
> > addresses on the outside to port numbers on the inside. This works fine
> > until you hit an internally generated redirect - at which point the port
> > number gets lost (ServerName preserves the external IP, but the internal
> > port is used instead of the external one). To fix this problem we
> > implemented a ServerPort directive, analogous to ServerName. I know I'm
> > pushing my luck for 1.3.2, but, nevertheless, here it is.
> 
> Why exactly do you need a ServerPort directive?  Using the Port directive
> with a Listen directive for that works for me.

Could be! Are you saying I should do something like this:

Listen 123
<VirtualHost a.b.c.d:123>
Port 80
...
</VirtualHost>

If so, I admit it hadn't occurred to me.

Cheers,

Ben.

-- 
Ben Laurie            |Phone: +44 (181) 735 0686| Apache Group member
Freelance Consultant  |Fax:   +44 (181) 735 0689|http://www.apache.org/
and Technical Director|Email: ben@algroup.co.uk |
A.L. Digital Ltd,     |Apache-SSL author     http://www.apache-ssl.org/
London, England.      |"Apache: TDG" http://www.ora.com/catalog/apache/

WE'RE RECRUITING! http://www.aldigital.co.uk/

Re: ServerPort directive

Posted by Marc Slemko <ma...@znep.com>.
On Mon, 14 Sep 1998, Ben Laurie wrote:

> The ServerName directive is handy for a variety of reasons, but one in
> particular is for use where NAT or load-balancing stuff is between you
> and the 'net. However, we ran into a problem recently - where you map IP
> addresses on the outside to port numbers on the inside. This works fine
> until you hit an internally generated redirect - at which point the port
> number gets lost (ServerName preserves the external IP, but the internal
> port is used instead of the external one). To fix this problem we
> implemented a ServerPort directive, analogous to ServerName. I know I'm
> pushing my luck for 1.3.2, but, nevertheless, here it is.

Why exactly do you need a ServerPort directive?  Using the Port directive
with a Listen directive for that works for me.