Hash ("#") in "Location"-HTTP-header - problems with IE

Discussion in 'Java' started by alexnb, Sep 9, 2005.

  1. alexnb

    alexnb Guest

    Hello,

    Can anyone help on the follwing problem:

    The serverside (e.g. a Java-Servlet) sends this HTTP-header:

    "Location: http://myhost/page.jsp?param1=value1#xyz"

    Mozilla,Opera reacts with the follwing GET:
    GET http://myhost/page.jsp?param1=value1

    _BUT_ the Internet Explorer
    GET http://myhost/page.jsp?param1=value1#xyz

    In case of IE this leads to:
    request.getParameter("param1") == "value1#xyz"

    Question 1: is it allowed to use # in Location-header?

    Question 2: shouldn't the servlet engine cut the #-part of the URL
    off??

    Thanks,
    Alex
    alexnb, Sep 9, 2005
    #1
    1. Advertising

  2. On 2005-09-09, alexnb <> wrote:
    > Hello,
    >
    > Can anyone help on the follwing problem:
    >
    > The serverside (e.g. a Java-Servlet) sends this HTTP-header:
    >
    > "Location: http://myhost/page.jsp?param1=value1#xyz"
    >
    > Mozilla,Opera reacts with the follwing GET:
    > GET http://myhost/page.jsp?param1=value1
    >
    > _BUT_ the Internet Explorer
    > GET http://myhost/page.jsp?param1=value1#xyz
    >
    > In case of IE this leads to:
    > request.getParameter("param1") == "value1#xyz"
    >
    > Question 1: is it allowed to use # in Location-header?


    No. According to the Hypertext Transfer Protocol -- HTTP/1.1 document
    (see http://www.faqs.org/rfcs/rfc2616.html), the value of the Location
    header is an absoluteURI. According to the Uniform Resource Identifiers
    (URI): Generic Syntax document (see http://www.faqs.org/rfcs/rfc2396.html)
    an absoluteURI may not contain a "#" character.

    According to that document a URI-reference may contat a "#" character;
    a URI-reference has the form

    [ absoluteURI | relativeURI ] [ "#" fragment ]
    A. Bolmarcich, Sep 9, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Derek Basch

    CGI and HTTP Header Location redirects

    Derek Basch, Feb 4, 2005, in forum: Python
    Replies:
    1
    Views:
    511
    Paul Rubin
    Feb 4, 2005
  2. Derek Basch
    Replies:
    0
    Views:
    329
    Derek Basch
    Feb 4, 2005
  3. Derek Basch
    Replies:
    1
    Views:
    298
    Paul Rubin
    Feb 5, 2005
  4. Replies:
    1
    Views:
    483
    =?Utf-8?B?Q2lhcmFuIE8nJ0Rvbm5lbGw=?=
    Nov 27, 2006
  5. rp
    Replies:
    1
    Views:
    491
    red floyd
    Nov 10, 2011
Loading...

Share This Page