Good detective work Alex!
I have added a patch to the CVS repository masking out the port
number from the host header iff the connection is against the
standard HTTP port number.
Tim Jackson's comment is entirely correct in that RFC 2616 (HTTP 1.1)
state, in section 14.23, that [:port] is part of the host header
value. HTTP/1.1 servers should handle this correctly. In your case I
suspect this may not be apaches fault but PHP. Anyway, fixed and part
of the next release. If you need a fix now, you can check out the
latest monit from the CVS.
Regards
On 13. mar. 2006, at 21.53, alex black wrote:
I have a theory,
(I didn't recompile because I'm using the debian package and
because ngrep allows me to fully debug the request/responses).
I poured over monit's requests. There is only one significant
difference:
Host: www.myhost.com:80.
It's adding the port number.
I tested this theory, and I was right:
telnet www.myhost.com 80
GET /catalog/list.php HTTP/1.1.
Host: www.myhost.com
Returns exactly what I would expect, a bunch of HTML.
telnet www.myhost.com 80
GET /catalog/list.php HTTP/1.1.
Host: www.myhost.com:80
Returns a 302.
Thus the problem.
I think my server is "right" - i.e. it's saying "don't use the :80.
So, how can I stop monit from appending the :80 to the host header?
:)
_a
------------------------------
ngrep -W byline -d lo port 80
interface: lo (127.0.0.0/255.0.0.0)
filter: ip and ( port 80 )
####
T my.ip.address:42354 -> my.ip.address:80 [AP]
GET /catalog/list.php HTTP/1.1.
Host: www.myhost.com:80.
Accept: */*.
User-Agent: monit/4.5.
.
##
T my.ip.address:80 -> my.ip.address:42354 [AP]
HTTP/1.1 302 Found.
Date: Sat, 11 Mar 2006 22:08:39 GMT.
Server: Apache/2.0.54 (Debian GNU/Linux) PHP/4.3.10-16 mod_ssl/
2.0.54 OpenSSL/0.9.7e.
X-Powered-By: PHP/4.3.10-16.
Expires: Tue, 1 Jan 1980 12:00:00 GMT.
Last-Modified: Sat, 11 Mar 2006 22:08:39 GMT.
Cache-Control: no-store, no-cache, must-revalidate, pre-check=0,
post-check=0, max-age=0.
Pragma: no-cache.
Set-Cookie: myhost=8d48d1ff9cecad7e5124eaab86c570e5; path=/.
Location: http://www.myhost.com//catalog/list.php.
Content-Length: 20.
Content-Type: text/html.
.
<!-- UNKNOWN sec -->
##
T my.ip.address:42354 -> my.ip.address:80 [AP]
GET http://www.myhost.com//catalog/list.php HTTP/1.1.
Host: www.myhost.com:80.
Accept: */*.
User-Agent: monit/4.5.
Cookie: myhost=8d48d1ff9cecad7e5124eaab86c570e5; path=/.
.
##
T my.ip.address:80 -> my.ip.address:42354 [AP]
HTTP/1.1 302 Found.
Date: Sat, 11 Mar 2006 22:08:40 GMT.
Server: Apache/2.0.54 (Debian GNU/Linux) PHP/4.3.10-16 mod_ssl/
2.0.54 OpenSSL/0.9.7e.
X-Powered-By: PHP/4.3.10-16.
Expires: Tue, 1 Jan 1980 12:00:00 GMT.
Last-Modified: Sat, 11 Mar 2006 22:08:40 GMT.
Cache-Control: no-store, no-cache, must-revalidate, pre-check=0,
post-check=0, max-age=0.
Pragma: no-cache.
Location: http://www.myhost.com/http://www.myhost.com//catalog/
list.php.
Content-Length: 20.
Content-Type: text/html.
.
<!-- UNKNOWN sec -->
##
On Mar 13, 2006, at 3:40 AM, Jan-Henrik Haukeland wrote:
On 11. mar. 2006, at 23.14, alex black wrote:
That's the thing: I can't get my webserver to return 302s to me
under any other circumstances:
telnet www.myhost.com 80
GET /catalog/list.php HTTP/1.1
HOST: www.myhost.com
returns (as I expect) an html payload from an external machine
and the server.
I have no special webserver config for monit, etc. I would expect
it to receive the same return as my tenet session. It doesn't.
Could you apply the enclosed patch (copy to monit dir and run,
'patch -p0 < httpdebug.patch' and recompile monit). This patch
logs the request sent by monit and the response from the server as
monit sees it. To isolate the case, edit your monitrc file and
only leave the url test. To make it easier to test you can also
run monit from the console and get output to the console by
running monit like this, 'monit -I validate'. Anything strange
going on?
Not sure what you did to get this response but it looks just like
the response monit had problems with. Also note how the Location-
header here is bogus (unless you edited this yourself :)
T my.ip.address:80 -> my.ip.address:42354 [AP]
HTTP/1.1 302 Found.
Date: Sat, 11 Mar 2006 22:08:40 GMT.
Server: Apache/2.0.54 (Debian GNU/Linux) PHP/4.3.10-16 mod_ssl/
2.0.54 OpenSSL/0.9.7e.
X-Powered-By: PHP/4.3.10-16.
Expires: Tue, 1 Jan 1980 12:00:00 GMT.
Last-Modified: Sat, 11 Mar 2006 22:08:40 GMT.
Cache-Control: no-store, no-cache, must-revalidate, pre-check=0,
post-check=0, max-age=0.
Pragma: no-cache.
Location: http://www.myhost.com/http://www.myhost.com//catalog/
list.php.
Content-Length: 20.
Content-Type: text/html.
.
<!-- UNKNOWN sec -->
<httpdebug.patch>
--
Jan-Henrik Haukeland
Mobil +47 97141255
--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general
--
alex black, founder
the turing studio, inc.
510.666.0074
[EMAIL PROTECTED]
http://www.turingstudio.com
2600 10th street, suite 635
berkeley, ca 94710
--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general
--
Jan-Henrik Haukeland
Mobil +47 97141255
--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general