IE7 inserting space in address bar before domain in URL

Posted on 2007-08-10
Last Modified: 2013-12-08
I have customers using IE7 that are trying to go to . The purpose of this default.jsp page is to
redirect people to the correct url based on the domain name in the address
bar. When I do the following in the JSP code it returns "".
I've only seen this for IE7 and it never happens with other browsers such as
IE5, IE6 or any Mozilla browser. Is there some bug in IE7 for HTTP request
headers ?

String var_server = request.getServerName().toLowerCase();
Question by:f0rdmstang
    LVL 5

    Accepted Solution

    Depending on your development environment, you should try running it in debug mode to make sure there's no extra spaces in the server name property.

    You could also try trimming the string:
    String var_server = request.getServerName().toLowerCase().trim();

    LVL 1

    Author Comment

    I've found the issue to be that IE7 in this case is inserting an extra space after the "Host: " header.  It seems that using the trim() function is a great workaround for my issue.
    LVL 5

    Expert Comment

    Are you sure IE7 was adding the space to the header, or was it simply not able to parse the header with a space like the other browsers could?
    Otherwise I'm not sure how trimming the spaces on the server side would fix an IE problem on the client side...

    Either way, I'm glad the solution worked for you...

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    Suggested Solutions

    Problem I downloaded the Microsoft Internet Explorer 9 Beta, today, to give it a test drive and maybe write a review for the site, and it failed miserably and got stuck in a crash restart loop. The error message given is as illustrated below i…
    Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
    This Micro Tutorial will demonstrate how nuggets on the Web are formatted by using Chrome Developer Tools. These tools would not only view the site's CSS but it can also modify it and save the CSS to use on your own site.
    Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now