Slashdot Mirror


Making Browsers Honor the DNS SearchDomain?

Craig A. Smith asks: "I've always been able to use simply 'http://www' to get to my company's web site, presumably because my default search domain was 'mycompany.com.' Suddenly my browser started taking me to 'www.www.com' instead. This happened simultaneously in all browsers (tested Mozilla, IE, NS4.7 and NS7.0) an two platforms (RedHat7.2 and Win2k). The odd thing is the command 'nslookup www' (or dig or host) behaves as desired and still resolves to www.mycompany.com so I don't think this is a DNS issue. I've tried various /etc/resolv.conf settings with no luck ('domain mycompany.com' and 'search mycompany.com'). How do I get my browser to apply the default domain before tacking on the www prefix and .com suffix?"

29 of 48 comments (clear)

  1. Your own hostname? by JimDabell · · Score: 2

    Check whether or not your own hostname has changed. Perhaps an admin changed the dhcp settings on the server.

  2. DNS by itwerx · · Score: 2, Insightful

    The technical answer:
    It's a lot more likely that something changed in the way your machine is resolving DNS. Go talk to your netadmin.

    The real answer:
    Nice Ask-Slashdot troll! :)

  3. Try Opera and disable server name completion? by Troodon · · Score: 3, Informative

    Sitting currently before Opera 6.05 on win2k:
    Preferences>Network>Server Name Completion>Uncheck 'Try name completion using'
    Problem solved, though perhaps not as elegant as getting your current browsers to behave.

    --
    troodon.net
  4. Is that server up? by Yuan-Lung · · Score: 3, Interesting

    When the target server, in this case, http://www.yourcompany.com, is not up, your browser, depending on setting, may start searching for an alternate location.

  5. quick fix... by OneFix · · Score: 2, Informative

    Add it to your hosts file.../etc/hosts for Linux and your default Windoze directory for that other OS...

    Another advantage of using this method is being able to use other abreviations for frequently visited sites...

    1. Re:quick fix... by Rick+the+Red · · Score: 2

      Um, I thought the whole point of DNS was so you didn't have to populate/maintain the hosts file in every computer.

      --
      If all this should have a reason, we would be the last to know.
    2. Re:quick fix... by OneFix · · Score: 2

      I was simply making the assumption that the author could not make the requested change at the DNS end...and while that is true, it doesn't mean that you shouldn't add aliases where you need/want them.

      For instance, the company I used to work for would have addresses for servers like d12stg034.atlanta.xxx.com ... now, if I knew this was the staging server for North America, it was much easier to make an alias...say "nastag"...and depending on the team you were on, "nastag" might have a different meaning...

      A DNS is not an excuse for not maintaining a hosts file...

    3. Re:quick fix... by Rick+the+Red · · Score: 2

      Granted, but I see the hosts file as something the user maintains as they see fit, and as you describe in the case of your "nastag" example ("depending on the team you were on, 'nastag' might have a different meaning"), not as something the Admin must maintain on all machines (so, for example, everyone can type "www" and reach the internal web server). Indeed, if you allow users to modify hosts you've pretty much gotta give up on central control -- that central control is what DNS is for.

      --
      If all this should have a reason, we would be the last to know.
  6. typical reply by charstar · · Score: 3, Funny

    it works on my machine

  7. Proxy? by skinfitz · · Score: 5, Insightful

    You've just got a new web proxy haven't you?

  8. It's probably your browser by PurpleFloyd · · Score: 3, Insightful
    If dig will give you the address/full DNS name you want, it's probably a "user-friendly" addition to your browser.

    I've noticed that browsers haven't required a http:// preceding the address for a long time, nor a slash on the end. While I do this out of habit, it seems most users aren't even accustomed to putting the protocol name in front of a name or address.

    I would suggest looking through your browser's documentation and configuration, as there's probably an option to turn off the offending problem.

    Note that one way to be sure, however, is to try and ping the server in question. Even if the server doesn't reply to ping requests, ping should give you some sort of address which you can compare to the one you want, without any user-hostility getting in your way.

    --

    That's it. I'm no longer part of Team Sanity.
  9. DCHP & Other Things by wdr1 · · Score: 5, Informative

    Are you using DHCP in Windows? That's the only thing I can think of that would cause all the applications to change at once.

    Linux side, I believe if you have 'domain' configured properly in /etc/resolve.conf you should be good to go. You mentioned nslookup works correctly, but does 'telnet www 80' take you to your originial site as well?

    A few other things:

    - Consider using keywords instead of relying upon DNS to do magic for you. Create a bookmark w/ your company's website & give it the keyword 'www'. That should fix you up. (Keywords are the most currently underrated feature in the browser. Especially in regards to their ability to do searches.)

    - You want to consider the above not only for convience, but also so your companies tracking doesn't get screwed up a little. When you hit the site with just 'www' (instead of 'www.foo.com') you drop your cookies. Most sites use cookies at least to track unique visitors if nothing else, and you're probably causing a minor bit of unintended cookie churn.

    - Another poster mentioned how browsers require neither 'http://', nor the trailing slash (e.g. on http://www.slashdot.org/). Defaulting to http probably isn't that bad. Especially inside a web browser. After all, it's highly unlikely the user intended gopher://. There is a difference on the trailing slash & it's better to include. If you try to hit a server w/o the trailing slash, you'll simply get a redirect from the server to the version *with* a slash. On broadband, it's totally trival, but for narrowband users, it is noticable. Something to worth keeping in mind for the URLs your link to.

    -Bill

    --
    SlashSig Karma: Excellent (mostly affected by moderatio
    1. Re:DCHP & Other Things by pne · · Score: 3, Informative

      There is a difference on the trailing slash & it's better to include. If you try to hit a server w/o the trailing slash, you'll simply get a redirect from the server to the version *with* a slash. On broadband, it's totally trival, but for narrowband users, it is noticable. Something to worth keeping in mind for the URLs your link to.

      That's not how I understand it -- after all, there isn't any possible path to request for an URL such as http://www.example.com other than "/". *fx: looks up RFC* Ah, there it is, from RFC 2616 "HTTP/1.1":

      3.2.2 http URL

      The "http" scheme is used to locate network resources via the HTTP protocol. This section defines the scheme-specific syntax and semantics for http URLs.

      http_URL = "http:" "//" host [ ":" port ] [ abs_path [ "?" query ]]

      If the port is empty or not given, port 80 is assumed. The semantics are that the identified resource is located at the server listening for TCP connections on that port of that host, and the Request-URI for the resource is abs_path (section 5.1.2). The use of IP addresses in URLs SHOULD be avoided whenever possible (see RFC 1900 [24]). If the abs_path is not present in the URL, it MUST be given as "/" when used as a Request-URI for a resource (section 5.1.2). If a proxy receives a host name which is not a fully qualified domain name, it MAY add its domain to the host name it received. If a proxy receives a fully qualified domain name, the proxy MUST NOT change the host name.

      (Emphasis added)

      You were probably thinking of paths such as http://www.example.com/some/path , which (if they are directories) typically get turned into redirects to http://www.example.com/some/path/ . But a bare http://www.example.com is legal and equivalent to http://www.example.com/ ; the HTTP request in either case should be "GET / HTTP/1.1" by my reading of the spec.

      --
      Esli epei etot cumprenan, shris soa Sfaha.
  10. nslookup is a poor test by Damien+Neil · · Score: 3, Informative

    nslookup does not use the system resolver library (gethostbyname and friends). As such, nslookup results won't tell you anything about how the system resolver is behaving.

    Check what host "ping www" resolves for a better idea of what the system resolver is up to.

    - Damien

  11. Re:Right section, wrong topic by fallacy · · Score: 2, Funny

    Perhaps it's about time we got a new icon for these sort of "Ask Slashdot" questions: a Google icon!!!

  12. IE does still require http:// at times by barzok · · Score: 4, Informative

    I've found that if you're using a site on anything but port 80, IE will choke trying to find it unless you prefix the URL with http://.

  13. How to do it: by GoRK · · Score: 5, Informative

    Here's the way to make pretty much any browser honor your search domain. This works in IE, Moz(win/linux), Opera (win/linux), Netscape:

    Type as: http://www/

    You can also try just typing www/ .. I seem to remember that that works in some of them.

    Also if you disable name completion which I know you can do in Opera (not sure about the others) then just plain www will work.

    Enjoy,

    ~GoRK

  14. Disable smart browsing features by photon317 · · Score: 3, Informative


    Your browser will probably go back to normal if look for and disable any features called "auto search", or "smart [browsing/urls/etc]". As a side note, one of the really annoying things about Netscape on Unix (at least the old 4.x versions), is that they actually read /etc/resolv.conf themselves, and query DNS servers themselves, instead of using the system's resolver library. You resolver might very well be configured to use some other source first, such as NIS+, but Netscape will have none of it.

    --
    11*43+456^2
  15. Re:User Interface Feature by Phexro · · Score: 2
    "This is just one of those IE-isms that Mozilla just copied."

    Uh, it has absolutely nothing to do with the browser. This is a feature of the resolver.

    E.g. in /etc/resolv.conf, I have:
    search private.domain.com


    And I have an A record for box.private.domain.com on my local DNS server.

    $ host box.private.domain.com
    box.private.domain.com A 192.168.0.1
    $ host box
    box.private.domain.com A 192.168.0.1
  16. Finally, somebody who has a clue by pauljlucas · · Score: 2
    Out of all these responses, I cna't believe that Troodon is the only one who got the answer right.

    This has nothing to do with DNS!
    It's a browser feature!

    OmniWeb also has it as "Shortcuts" under Preferences.

    --
    If you reply, do so only to what I explicitly wrote. If I didn't write it, don't assume or infer it.
    1. Re:Finally, somebody who has a clue by gengee · · Score: 2

      Umm, no nitwit, it has everything to do with DNS. While it certainly may be true that some browsers do their own freaky things, it's most certainyl a DNS feature:P

      Search prefix:P Look in /etc/resolv.conf (Or your OS' equivalent).

      In /etc/resolv.conf, you can type 'search yahoo.com' at the top. Then, 'nslookup www' will resolve www.yahoo.com'

      --
      - James
    2. Re:Finally, somebody who has a clue by pauljlucas · · Score: 3, Informative
      The submitter didn't change his search prefix. He even stated that nslookup works correctly. That being the case, it's not a DNS issue. It's the browser that is at fault.

      Nitwit.

      --
      If you reply, do so only to what I explicitly wrote. If I didn't write it, don't assume or infer it.
    3. Re:Finally, somebody who has a clue by gengee · · Score: 2

      Heh, my bad.

      Only read the comment, not the posting:P

      Dirty habbit.

      --
      - James
  17. Dear Slashdot: by Hubert_Shrump · · Score: 2

    How can I stop having these horrible, incapacitating flashbacks?!

    --
    Keep your packets off my GNU/Girlfriend!
  18. Re:WFM by josepha48 · · Score: 2
    Its not a windowism (could be a last century windowism (95/98, etc), as it works for me as well and I'm using win2k. I'm using mozilla 1.2.1.

    We don't use dhcp (small company). I'd think it may have to do with 'internet keywords' in smart browsing.

    Internet Keywords are a method of trying to work out what you meant when you type something that is not a URL into the URL bar. One option would be do perform a search on the words; the Internet Keywords system does this if your query doesn't match any of the things it knows about. However, before that, it knows a number of other things to try. There are certain prefixes, such as "shop" or "quote", which perform specialised searches, and you can also get information relating to a set of American cities by placing them first, e.g. "San Francisco restaurants".
    --

    Only 'flamers' flame!

  19. My thought too by 0x0d0a · · Score: 3, Informative

    Be an *exact* explanation of the problem.

    If they're using squid, they can recompile and tell it to not use the internal resolver...otherwise, it'll ignore searchdomains.

  20. its a hidden preference by jon787 · · Score: 2

    http://www.geocities.com/pratiksolanki/

    // Turn off domain guessing (which adds www. and .com) for link URLs
    // This means that if you type http://cnn/, Mozilla will not try
    // to go to http://www.cnn.com. For more details read bug 34943
    // This will also fix the nasty bug where clicking in history folder
    // results in Mozilla going to www.apps5.oingo.com
    user_pref("browser.fixup.alternate.enabled", false);

    --
    X(7): A program for managing terminal windows. See also screen(1).
  21. What changed? by Rick+the+Red · · Score: 2
    This is the best answer yet. The real question for you to ask is: "What changed?" All the folks spouting off about how it's the browser, or it's the resolver -- folks, he used to type "http://www" and get the local box he wanted. Now that no longer works. So, what changed? I'm thinking the proxy is as good a bet as anything -- I doubt your browser changed, or you would know, right?

    Here, I can just type "www" and get the local server. Mozilla seems to change that to "http://www/". If I "ping www" I get "Pinging www.companyname.com [blah blah]" but the browser doesn't show "http:/www.companyname.com/". So I don't know how Mozilla or DNS or the resolver or anything is doing this, it just works; if it stopped working, I'd ask what changed.

    --
    If all this should have a reason, we would be the last to know.
  22. Re:User Interface Feature by penguinboy · · Score: 2

    This is just one of those IE-isms that Mozilla just copied.

    Not exactly. Netscape has had this sort of feature (type in a single-segment name and it'll automatically put 'www' before it and '.com' after it, for example) since I first used Netscape Communicator 2.0 in 1996.