Received: (qmail 91457 invoked by uid 501); 15 Dec 2000 11:41:46 -0000 Message-Id: <20001215114146.91456.qmail@locus.apache.org> Date: 15 Dec 2000 11:41:46 -0000 From: Susumu Kajino Reply-To: kajino@nis.nec.co.jp To: submit@bugz.apache.org Subject: A port forwarding problem. X-Send-Pr-Version: 3.110 >Number: 6982 >Category: general >Synopsis: A port forwarding problem. >Confidential: no >Severity: non-critical >Priority: medium >Responsible: apache >State: closed >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: apache >Arrival-Date: Fri Dec 15 03:50:01 PST 2000 >Closed-Date: Mon Dec 18 22:39:21 PST 2000 >Last-Modified: Mon Dec 18 22:39:21 PST 2000 >Originator: kajino@nis.nec.co.jp >Release: 1.3.14 >Organization: >Environment: Do not depend on machine environment. However, environment of this place is SunOS 5.6 Generic_105181-22 sun4u sparc SUNW,Ultra-250. >Description: It is assumed that there was the following environment. | | (waiting port/80) [Port forwarding device] (ex. BIG/ip) | | (connecting port/2000) [Web Server waiting port 2000] When I access 'test' directory of DocumentRoot subordinates as http://www.domain/test then Server answers it as follows. % telnet localhost 80 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. GET http://www.domain/test HTTP/1.0 HTTP/1.1 301 Moved Permanently Date: Fri, 15 Dec 2000 10:55:52 GMT Server: Apache/1.3.14 (Unix) Location: http://www.domain:2000/test/ Connection: close Content-Type: text/html 301 Moved Permanently

Moved Permanently

The document has moved here.

Connection closed by foreign host. Because server adds the port number that oneself works and turns over "Moved Permanently" when I do port forwarding, error occurs. >How-To-Repeat: Please prepare the environment that can access server by a change of access port. And access not to add "/" to one directory last. >Fix: Add directive to appoint the port number that I want to indicate as "Moved Permanently" to "httpd.conf". For example, I add attachment of "ForwardPort 80" in "httpd.conf" if I add directive of ForwardPort. The following is patch of that purpose. #Will it be a right solution method? *** src/include/httpd.h.ORG Mon Nov 27 18:26:07 JST 2000 --- src/include/httpd.h Mon Nov 27 18:26:53 JST 2000 *************** *** 921,924 **** --- 921,925 ---- char *server_hostname; unsigned short port; /* for redirects, etc. */ + unsigned short fwd_port; /* forward port for display only. */ /* Log files --- note that transfer log is now in the modules... */ *** src/main/http_core.c.ORG Wed Oct 11 02:33:09 JST 2000 --- src/main/http_core.c Mon Nov 27 20:13:19 JST 2000 *************** *** 742,745 **** --- 742,746 ---- { unsigned port; + unsigned fwd_port; core_dir_config *d = (core_dir_config *)ap_get_module_config(r->per_dir_config, &core_module); *************** *** 746,749 **** --- 747,752 ---- port = r->server->port ? r->server->port : ap_default_port(r); + fwd_port = r->server->fwd_port; + if (fwd_port) port = fwd_port; if (d->use_canonical_name == USE_CANONICAL_NAME_OFF *************** *** 1924,1927 **** --- 1927,1948 ---- } + static const char *forward_port(cmd_parms *cmd, void *dummy, char *arg) + { + const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); + int fwd_port; + + if (err != NULL) { + return err; + } + fwd_port = atoi(arg); + if (fwd_port <= 0 || fwd_port >= 65536) { /* 65536 == 1<<16 */ + return ap_pstrcat(cmd->temp_pool, "The port number \"", arg, + "\" is outside the appropriate range " + "(i.e., 1..65535).", NULL); + } + cmd->server->fwd_port = fwd_port; + return NULL; + } + static const char *set_signature_flag(cmd_parms *cmd, core_dir_config *d, char *arg) *************** *** 2870,2873 **** --- 2891,2896 ---- /* Old server config file commands */ + + { "ForwardPort", forward_port, NULL, RSRC_CONF, TAKE1, "A TCP forwarded port number"}, { "ServerType", server_type, NULL, RSRC_CONF, TAKE1, >Release-Note: >Audit-Trail: From: Tony Finch To: Susumu Kajino Cc: apbugs@apache.org Subject: Re: general/6982: A port forwarding problem. Date: Sat, 16 Dec 2000 00:09:10 +0000 Does it work if you configure as follows? Listen 2000 Port 80 Tony. -- f.a.n.finch fanf@covalent.net dot@dotat.at "Well, as long as they can think we'll have our problems. But those whom we're using cannot think." From: kajino@nis.nec.co.jp To: Tony Finch Cc: Susumu Kajino , apbugs@apache.org Subject: Re: general/6982: A port forwarding problem. Date: Mon, 18 Dec 2000 09:41:11 +0900 >>In Article <20001216000910.J30096@hand.dotat.at> > Tony Finch writes: >Does it work if you configure as follows? > > Listen 2000 > Port 80 Perhaps it will be YES. However, because separate httpd moves in "Port 80" already, it cannot. Best Regards //////////////////////////////////////////////////////////////// NEC informatec systems Co.,ltd. Tel.+81-44-812-8418 Network SI Div., 2nd SI Dept. S.Kajino kajino@ksp.nis.nec.co.jp kajino@mvi.biglobe.ne.jp State-Changed-From-To: open-feedback State-Changed-By: slive State-Changed-When: Mon Dec 18 09:35:21 PST 2000 State-Changed-Why: You misunderstood Tony. Check the docs on Port, and you will see that when a Listen directive is specified, Port DOES NOT set the actual port that Apache listens to. It only sets the port used in redirects, etc. Tony's suggested configuration should work perfectly in your situation. Release-Changed-From-To: apache_1.3.14-1.3.14 Release-Changed-By: slive Release-Changed-When: Mon Dec 18 09:35:21 PST 2000 From: =?ISO-2022-JP?B?IlMuS2FqaW5vLxskQjNhTG4/OBsoQiIg?= To: slive@apache.org Cc: apache-bugdb@apache.org, apbugs@Apache.Org Subject: Re: general/6982: A port forwarding problem. Date: Tue, 19 Dec 2000 15:05:36 +0900 >You misunderstood Tony. Check the docs on Port, and >you will see that when a Listen directive is specified, >Port DOES NOT set the actual port that Apache listens Yes, I found it. I misunderstood that "Port" did bind the port, actually. >Tony's suggested configuration should work perfectly >in your situation. I was able to confirm it. Thanks a lot!! Best Regards //////////////////////////////////////////////////////////////// NEC informatec systems Co.,ltd. TEL +81-44-812-8418 Network SI Div., 2nd SI Dept. S.Kajino kajino@ksp.nis.nec.co.jp kajino@mvi.biglobe.ne.jp State-Changed-From-To: feedback-closed State-Changed-By: slive State-Changed-When: Mon Dec 18 22:39:20 PST 2000 State-Changed-Why: Problem solved by using Port/Listen. >Unformatted: [In order for any reply to be added to the PR database, you need] [to include in the Cc line and make sure the] [subject line starts with the report component and number, with ] [or without any 'Re:' prefixes (such as "general/1098:" or ] ["Re: general/1098:"). If the subject doesn't match this ] [pattern, your message will be misfiled and ignored. The ] ["apbugs" address is not added to the Cc line of messages from ] [the database automatically because of the potential for mail ] [loops. If you do not include this Cc, your reply may be ig- ] [nored unless you are responding to an explicit request from a ] [developer. Reply only with text; DO NOT SEND ATTACHMENTS! ]