users@glassfish.java.net

Strange behaviour/bug with remote GF 3.0.1: HTTP/1.1 302 Moved Temporarily

From: <glassfish_at_javadesktop.org>
Date: Fri, 23 Jul 2010 12:57:25 PDT

I have monitored the following with a clean glassfish 3.0.1 installation:

1. stop glassfish with asadmin

2. start glassfish with asadmin

3. open browser and call the server, i.e. [b]www.mydomain.com[/b]
I did not change anything, so the default index.html file of the document root is displayed (/op/glassfishv3/glassfish/domains/domain1/docroot/index.html)

4. The browser displays ocasionally (very often):
- Firefox / IE: [b]http://www.mydomain.com/index.html[/b] instead of [b]http://www.mydomain.com/[/b]
- Safari: [b]http://www.mydomain.com:80/index.html[/b] instead of [b]http://www.mydomain.com/[/b]


I could not explain what I saw in step 4. Sometimes [b]http://www.mydomain.com/[/b] was displayed, which is what I expected. But the sometimes what I described in step 4 is displayed within the URL bar of the browsers.

So I installed a tool for watching the http traffic. It shows me the following:

[b]HTTP/1.1 302 Moved Temporarily
Location: http://www.mydomain.com:80/index.html
Connection: close
Cache-Control: private
Date: Fri, 23 Jul 2010 19:04:08 GMT[/b]

As you see this is a redirect from the Glassfish Server. It seems this makes Safari display even the default port 80, whereas the other browsers don't do that. But all have in common that they redirect to the new URL defined in the header and they display it in the URL bar:

[b]Location: http://www.mydomain.com:80/index.html[/b]

I have no idea why this happens, but I can tell it happens very often and I do not like this behaviour. Especially because it happens totally ocasionally (at least as it seemed so far)!

Here is my environment where my Glassfish is running:
- Glassfish 3.0.1 Remote Server on Ubuntu Server 8.04 (Hardy)
- Glassfish is running with a non-root user called "glassfish"
- Ubuntu firewall is configured to forward port 80 to 8080 with the following iptables rule:
[b]iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080[/b]

So far I don't see anything I did wrong. After analyzing this strange behaviour I found out the following:

5. Call the login page of the glassfish admin concole by typing the following url into you browser: [b]https://www.mydomain.com:4848/[/b]

6. now again try to open the browser with [b]www.mydomain.com[/b] (same as step 4)

7. This time it works all as expected:

[b]HTTP/1.1 200 OK
X-Powered-By: Servlet/3.0
Server: GlassFish Server Open Source Edition 3.0.1
Accept-Ranges: bytes
Etag: W/"1090-1276886352000"
Last-Modified: Fri, 18 Jun 2010 18:39:12 GMT
Content-Type: text/html
Content-Length: 1090
Date: Fri, 23 Jul 2010 19:24:58 GMT
Connection: close

<html>
  <head>
  [...][/b]

Isn't that strange???

I am not very sure, but I think after letting Glassfish running for a while the issue might occur again. I will let you know if I can prove that somehow or if I can't.

Can anyone reproduce this issue?
I think this is a behaviour that should be eliminated - it is simply not the standard behaviour that one would expect.

I hope someone will take this over since I have already spent a lot of time into this.

Nabi
[Message sent by forum member 'nabizamani']

http://forums.java.net/jive/thread.jspa?messageID=478440