From 2c85f998979d1277268b36b55e2ad2e857235695 Mon Sep 17 00:00:00 2001 From: dgaudet Date: Sun, 1 Feb 1998 22:05:29 +0000 Subject: [PATCH] Add the UseCanonicalName directive which controls how self-referential redirects are generated. This was at least approved in spirit by a handful of folks two weeks ago. The default should be no behaviour change. This changes the prototype of construct_url(), and adds two new API functions: get_server_name() and get_server_port(). So the MODULE_MAGIC_NUMBER has been bumped. PR: 315, 459, 485, 1433 Submitted by: Michael Douglass , Dean Gaudet git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@80076 13f79535-47bb-0310-9956-ffa450edef68 --- docs/manual/mod/core.html | 67 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 63 insertions(+), 4 deletions(-) diff --git a/docs/manual/mod/core.html b/docs/manual/mod/core.html index 195d6a4d83..132aa347d2 100644 --- a/docs/manual/mod/core.html +++ b/docs/manual/mod/core.html @@ -79,6 +79,7 @@ always available.
  • StartServers
  • ThreadsPerChild
  • TimeOut +
  • UseCanonicalName
  • User
  • <VirtualHost> @@ -1788,7 +1789,9 @@ listens at. sets the SERVER_PORT environment variable (for CGI and SSI), and is used when the server must generate a URL that refers to itself -(for example when creating an external redirect to itself). +(for example when creating an external redirect to itself). This +behaviour is modified by +UseCanonicalName. In no event does a Port setting affect @@ -1798,7 +1801,8 @@ VirtualHost directive itself is used for that.

    The primary behaviour of Port should be considered to be similar to that of the ServerName directive. The ServerName and Port together specify what you consider to be the canonical -address of the server.

    +address of the server. +(See also UseCanonicalName.)

    Port 80 is one of Unix's special ports. All ports numbered below 1024 are reserved for system use, i.e. regular (non-root) users cannot @@ -2186,8 +2190,10 @@ not work reliably, or may not return the preferred hostname. For example:

    ServerName www.wibble.com
    would be used if the canonical (main) name of the actual machine were monster.wibble.com.

    -

    See Also: -DNS Issues

    +

    See Also:
    +DNS Issues
    +UseCanonicalName
    +


    ServerPath directive

    @@ -2433,6 +2439,59 @@ a packet is sent.


    +

    UseCanonicalName directive

    + + +Syntax: UseCanonicalName on|off
    + +Default: UseCanonicalName on
    + +Context: server config, virtual host, directory, .htaccess
    + +Override: AuthConfig
    + +Compatibility: UseCanonicalName is only available in Apache 1.3 and later

    + +In many situations Apache has to construct a self-referential +URL. That is, a URL which refers back to the same server. +With UseCanonicalName on (and in all versions prior to +1.3) Apache will use the ServerName and Port directives to construct a canonical name for the +server. This name is used in all self-referential URLs, and for the +values of SERVER_NAME and SERVER_PORT in CGIs. + +

    With UseCanonicalName off Apache will form +self-referential URLs using the hostname and port supplied +by the client if any are supplied (otherwise it will use the +canonical name). These values are the same that are used to +implement name based virtual +hosts, and are available with the same clients. The CGI variables +SERVER_NAME and SERVER_PORT will be constructed +from the client supplied values as well. + +

    An example where this may be useful is on an intranet server where +you have users connecting to the machine using short names such as +www. You'll notice that if the users type a shortname, +and a URL which is a directory, such as http://www/splat, +without the trailing slash then Apache will redirect them to +http://www.domain.com/splat/. If you have authentication +enabled, this will cause the user to have to reauthenticate twice (once +for www and once again for www.domain.com). +But if UseCanonicalName is set off, then Apache will redirect +to http://www/splat/. + +

    Warning: if CGIs make assumptions about the values of +SERVER_NAME they may be broken by this option. The client +is essentially free to give whatever value they want as a hostname. +But if the CGI is only using SERVER_NAME to construct +self-referential URLs then it should be just fine. + +

    See also: +ServerName, +Port + +


    +

    User directive