You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Kenneth Westelinck <ke...@gmail.com> on 2007/04/03 10:07:02 UTC

Re: Need help with authentication

Any ideas why I only get redirected in firefox after doing a refresh and why
this is working as it should in internet explorer?

Re: Need help with authentication

Posted by Kenneth Westelinck <ke...@gmail.com>.
Hi again,

I did some further researching. I found this on the 304 returned by Tomcat
when using firefox:
-----8<-------8<-------8<-------8<-------8<-------8<-------8<-------8<-------8<-------8<-------8<-------8<-------8<-------8<-------8<--
You should never see this error in your Web browser. It should simply
present the Web page from its cache - because it believes the page has not
changed since it was last cached. If your client is not a Web browser, then
it should equally be able to present the page from a cache. If unable to do
so, it is not using the If_Modified_Since or related headers correctly.
-----8<-------8<-------8<-------8<-------8<-------8<-------8<-------8<-------8<-------8<-------8<-------8<-------8<-------8<-------8<--

When I disable caching in firefox, authentication works as it should and I
get redirected as I should. So who's the culprit here. Firefox or Tomcat?

Sorry, I'm a bit puzzled :(

Re: Need help with authentication

Posted by Kenneth Westelinck <ke...@gmail.com>.
Ok, here is some headers I found with "fiddler":
>From firefox:

- Request 1:
GET /eai-admin/ HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3)
Gecko/20070309 Firefox/2.0.0.3
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9
,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Proxy-Connection: keep-alive
Cookie: JSESSIONID=8BE2C3B8AD18A29D2229F467A9391307
If-Modified-Since: Fri, 23 Feb 2007 15:40:10 GMT
If-None-Match: W/"1827-1172245210656"
- Reply 1:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Pragma: No-cache
Cache-Control: no-cache
Expires: Thu, 01 Jan 1970 01:00:00 CET
Content-Type: text/html;charset=ISO-8859-1
Content-Length: 602
Date: Wed, 04 Apr 2007 07:27:13 GMT

<html>
<head>
<title>Login Page for Examples</title>
<body bgcolor="white">
<form method="POST" action='j_security_check' >
  <table border="0" cellspacing="5">
    <tr>
      <th align="right">Username:</th>
      <td align="left"><input type="text" name="j_username"></td>
    </tr>
    <tr>
      <th align="right">Password:</th>
      <td align="left"><input type="password" name="j_password"></td>
    </tr>
    <tr>
      <td align="right"><input type="submit" value="Log In"></td>
      <td align="left"><input type="reset"></td>
    </tr>
  </table>
</form>
</body>
</html>
Reply 1 is normal, this is my login page.

- Then I submit the login, Request 2:
POST /eai-admin/j_security_check HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3)
Gecko/20070309 Firefox/2.0.0.3
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9
,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Proxy-Connection: keep-alive
Referer: http://localhost:8080/eai-admin/
Cookie: JSESSIONID=8BE2C3B8AD18A29D2229F467A9391307
Content-Type: application/x-www-form-urlencoded
Content-Length: 30

j_username=tim&j_password=test
- Reply 2
HTTP/1.1 302 Moved Temporarily
Server: Apache-Coyote/1.1
Location: http://localhost:8080/eai-admin/
Content-Length: 0
Date: Wed, 04 Apr 2007 07:27:17 GMT

- So I get redirected:
GET /eai-admin/ HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3)
Gecko/20070309 Firefox/2.0.0.3
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9
,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Proxy-Connection: keep-alive
Referer: http://localhost:8080/eai-admin/
Cookie: JSESSIONID=8BE2C3B8AD18A29D2229F467A9391307
- Reply 3:
HTTP/1.1 304 Not Modified
Server: Apache-Coyote/1.1
Pragma: No-cache
Cache-Control: no-cache
Expires: Thu, 01 Jan 1970 01:00:00 CET
Date: Wed, 04 Apr 2007 07:27:17 GMT

For IE I can see the following:
- Request 1:
GET /eai-admin/ HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/x-shockwave-flash, application/vnd.ms-excel,
application/vnd.ms-powerpoint, application/msword, */*
Accept-Language: nl-be
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR
2.0.50727; .NET CLR 1.1.4322)
Host: localhost:8080
Proxy-Connection: Keep-Alive
- Reply 1:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Pragma: No-cache
Cache-Control: no-cache
Expires: Thu, 01 Jan 1970 01:00:00 CET
Set-Cookie: JSESSIONID=619A92CCA43BBE0FB205AA7455360214; Path=/
Content-Type: text/html;charset=ISO-8859-1
Content-Length: 646
Date: Wed, 04 Apr 2007 07:30:35 GMT

<html>
<head>
<title>Login Page for Examples</title>
<body bgcolor="white">
<form method="POST"
action='j_security_check;jsessionid=619A92CCA43BBE0FB205AA7455360214' >
  <table border="0" cellspacing="5">
    <tr>
      <th align="right">Username:</th>
      <td align="left"><input type="text" name="j_username"></td>
    </tr>
    <tr>
      <th align="right">Password:</th>
      <td align="left"><input type="password" name="j_password"></td>
    </tr>
    <tr>
      <td align="right"><input type="submit" value="Log In"></td>
      <td align="left"><input type="reset"></td>
    </tr>
  </table>
</form>
</body>
</html>

- Request 2:
POST /eai-admin/j_security_check;jsessionid=619A92CCA43BBE0FB205AA7455360214
HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/x-shockwave-flash, application/vnd.ms-excel,
application/vnd.ms-powerpoint, application/msword, */*
Referer: http://localhost:8080/eai-admin/
Accept-Language: nl-be
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR
2.0.50727; .NET CLR 1.1.4322)
Host: localhost:8080
Content-Length: 30
Proxy-Connection: Keep-Alive
Pragma: no-cache
Cookie: JSESSIONID=619A92CCA43BBE0FB205AA7455360214

j_username=tim&j_password=test
- Reply 2:
HTTP/1.1 302 Moved Temporarily
Server: Apache-Coyote/1.1
Location: http://localhost:8080/eai-admin/
Content-Length: 0
Date: Wed, 04 Apr 2007 07:30:39 GMT

- Request 3:
GET /eai-admin/ HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/x-shockwave-flash, application/vnd.ms-excel,
application/vnd.ms-powerpoint, application/msword, */*
Referer: http://localhost:8080/eai-admin/
Accept-Language: nl-be
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR
2.0.50727; .NET CLR 1.1.4322)
Host: localhost:8080
Proxy-Connection: Keep-Alive
Pragma: no-cache
Cookie: JSESSIONID=619A92CCA43BBE0FB205AA7455360214
- Reply 3:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Pragma: No-cache
Cache-Control: no-cache
Expires: Thu, 01 Jan 1970 01:00:00 CET
ETag: W/"1827-1172245210656"
Last-Modified: Fri, 23 Feb 2007 15:40:10 GMT
Content-Type: text/html
Content-Length: 1827
Date: Wed, 04 Apr 2007 07:30:39 GMT

<html>
<head>
... rest of the html page.

So when using IE, I get redirected correctly and the page is returned in
Reply 3. In firefox, nothing is returned in Reply 3.

Re: Need help with authentication

Posted by Mark Thomas <ma...@apache.org>.
Kenneth Westelinck wrote:
> Any ideas why I only get redirected in firefox after doing a refresh and
> why
> this is working as it should in internet explorer?
> 

Get ieHttpHeaders and Live Http Headers and check out the differences,
if any, in what the browsers are seeing from / sending to Tomcat.

Mark

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org