You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Helge Laurisch <He...@Laurisch.DynDns.org> on 2002/07/07 12:15:11 UTC

[PATCH] Port Redirection behind VIP to Port Balancer

*** ../original_httpd-2.0.39/include/http_core.h	Sun May 12 01:24:29 2002
--- include/http_core.h	Sun Jul  7 11:47:04 2002
***************
*** 460,467 ****
  #define USE_CANONICAL_NAME_OFF   (0)
  #define USE_CANONICAL_NAME_ON    (1)
  #define USE_CANONICAL_NAME_DNS   (2)
! #define USE_CANONICAL_NAME_UNSET (3)
!     unsigned use_canonical_name : 2;
  
      /* since is_fnmatch(conf->d) was being called so frequently in
       * directory_walk() and its relatives, this field was created and
--- 460,468 ----
  #define USE_CANONICAL_NAME_OFF   (0)
  #define USE_CANONICAL_NAME_ON    (1)
  #define USE_CANONICAL_NAME_DNS   (2)
! #define USE_CANONICAL_NAME_FIXED (3)
! #define USE_CANONICAL_NAME_UNSET (4)
!     unsigned use_canonical_name : 2;
  
      /* since is_fnmatch(conf->d) was being called so frequently in
       * directory_walk() and its relatives, this field was created and
*** server/core.c.orig	Sun Jul  7 11:03:20 2002
--- server/core.c	Sun Jul  7 11:28:37 2002
***************
*** 891,896 ****
--- 891,901 ----
      core_dir_config *d =
        (core_dir_config *)ap_get_module_config(r->per_dir_config,
&core_module);
  
+ 	  if (d->use_canonical_name == USE_CANONICAL_NAME_FIXED) {
+ 		  			return 80;
+ 	  }
+ 	  else {
+ 
    	  if (d->use_canonical_name == USE_CANONICAL_NAME_OFF
    	      || d->use_canonical_name == USE_CANONICAL_NAME_DNS) {
  	
***************
*** 916,921 ****
--- 921,927 ----
       	          r->connection->local_addr->port ?
r->connection->local_addr->port :
       	          ap_default_port(r);
      	}
+ 	  	}
  
      /* default */
      return port;
***************
*** 2150,2155 ****
--- 2156,2164 ----
      else if (strcasecmp(arg, "dns") == 0) {
          d->use_canonical_name = USE_CANONICAL_NAME_DNS;
      }
+ 	 else if (strcasecmp(arg, "fixed") == 0) {
+ 	     d->use_canonical_name = USE_CANONICAL_NAME_FIXED;
+ 	 }
      else {
          return "parameter must be 'on', 'off', or 'dns'";
      }

-- 

#========================================================
# This Patch is for Server Cluster which are using only one single 
# Interfaces for the Real Server behing a port mapping Load Balancer.
# -----------------------------------------------------------------------
# -------

Example:
* you have a load balancer with many VIPs listening on Port 80.
* Each VIP redirects his requests to the Real Server Farm on a special
Port:
  www.domain1.com gets mapped to Realserver.farm.com:81
  www.domain2.com gets mapped to Realserver.farm.com:82
  www.domain3.com gets mapped to Realserver.farm.com:83

without this Patch it isn't possible to catch the trailing Slash Problem, 
because a request from the client to:

   http://www.domain1.com/test 

gets redirected to:

   http://www.domain1.com:81/test/

but the Load Balancer only listens at Port 80, because it should be
transparent
for the User.

So you can just use "UseCanonicalName Fixed" and the Server will always
redirect
the Client to Port 80.


Sincerely
Helge Laurisch

Linux: Because rebooting is for adding new hardware.  

Re: [PATCH] Port Redirection behind VIP to Port Balancer

Posted by Helge Laurisch <He...@Laurisch.DynDns.org>.
-------Original Message-------
From: "Cliff Woolley" <jw...@virginia.edu> 

> You shouldn't need this patch to get what you want.  The other
> UseCanonicalName settings along with the ServerName directive should be
> able to give you what you want, I believe.

AFAIK this is not implemented. 
see this set up is for one VIP which has 500 different Domain Names, so if
you do a lookup, you will get not the same Domainname as the User might
entered. 

This setup is needed when you dont want to modify the hostname but you
need do change the PORT Number.

and i think this is not implemented that way. (and i tried it ;o)) 


-- 
Sincerely
Helge Laurisch

Calculating in binary code is as easy as 01,10,11.  

Re: [PATCH] Port Redirection behind VIP to Port Balancer

Posted by Cliff Woolley <jw...@virginia.edu>.
On Sun, 7 Jul 2002, Helge Laurisch wrote:

>    http://www.domain1.com/test
> gets redirected to:
>    http://www.domain1.com:81/test/
>
> but the Load Balancer only listens at Port 80, because it should be
> transparent
> for the User.
> So you can just use "UseCanonicalName Fixed" and the Server will always
> redirect
> the Client to Port 80.

You shouldn't need this patch to get what you want.  The other
UseCanonicalName settings along with the ServerName directive should be
able to give you what you want, I believe.

--Cliff