Safari is unable to reach localhost (127.0.0.1)





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







7















I've encountered a really strange Mac problem: Safari is unable to connect to localhost whereas all other applications can connect as normal (Firefox, Chrome, ping, etc.).



My /etc/hosts is the standard setup:



$ egrep localhost /etc/hosts
# localhost is used to configure the loopback interface
127.0.0.1 localhost
::1 localhost
fe80::1%lo0 localhost
127.0.0.1 testing.localhost


Question: Have anyone else encountered this? What could be the problem?



Update #1: I have a server running on localhost:8080. When accessing from Safari I get the error message "Safari could not connect to the server". "http://localhost:8080/" works flawlessly in Firefox and Chrome.



Update #2: Same problem with "http://127.0.0.1:8080/" - so it does not seem to be related to resolving localhost to 127.0.0.1.










share|improve this question

























  • Is there any remote chance your are using a proxy server?

    – BinaryMisfit
    Sep 3 '09 at 8:34











  • Diago: I'm not using a proxy server.

    – knorv
    Sep 4 '09 at 8:17






  • 1





    What's the http server running on localhost?

    – nagul
    Sep 6 '09 at 10:55






  • 1





    For the archives (see comments at grawity's answer), though it does not solve the question above: on my Mac OS X 10.6, with the /etc/hosts as above and IPv6 left at its default automatic, requesting 127.0.0.1:8080 makes Safari use IPv4 (which could still connect to a server providing IPv6). Requesting localhost:8080 makes Safari use IPv6.

    – Arjan
    Sep 7 '09 at 15:14











  • how about sniffing to see what the difference is between the two browsers' requests?

    – mihi
    Sep 8 '09 at 17:28


















7















I've encountered a really strange Mac problem: Safari is unable to connect to localhost whereas all other applications can connect as normal (Firefox, Chrome, ping, etc.).



My /etc/hosts is the standard setup:



$ egrep localhost /etc/hosts
# localhost is used to configure the loopback interface
127.0.0.1 localhost
::1 localhost
fe80::1%lo0 localhost
127.0.0.1 testing.localhost


Question: Have anyone else encountered this? What could be the problem?



Update #1: I have a server running on localhost:8080. When accessing from Safari I get the error message "Safari could not connect to the server". "http://localhost:8080/" works flawlessly in Firefox and Chrome.



Update #2: Same problem with "http://127.0.0.1:8080/" - so it does not seem to be related to resolving localhost to 127.0.0.1.










share|improve this question

























  • Is there any remote chance your are using a proxy server?

    – BinaryMisfit
    Sep 3 '09 at 8:34











  • Diago: I'm not using a proxy server.

    – knorv
    Sep 4 '09 at 8:17






  • 1





    What's the http server running on localhost?

    – nagul
    Sep 6 '09 at 10:55






  • 1





    For the archives (see comments at grawity's answer), though it does not solve the question above: on my Mac OS X 10.6, with the /etc/hosts as above and IPv6 left at its default automatic, requesting 127.0.0.1:8080 makes Safari use IPv4 (which could still connect to a server providing IPv6). Requesting localhost:8080 makes Safari use IPv6.

    – Arjan
    Sep 7 '09 at 15:14











  • how about sniffing to see what the difference is between the two browsers' requests?

    – mihi
    Sep 8 '09 at 17:28














7












7








7


7






I've encountered a really strange Mac problem: Safari is unable to connect to localhost whereas all other applications can connect as normal (Firefox, Chrome, ping, etc.).



My /etc/hosts is the standard setup:



$ egrep localhost /etc/hosts
# localhost is used to configure the loopback interface
127.0.0.1 localhost
::1 localhost
fe80::1%lo0 localhost
127.0.0.1 testing.localhost


Question: Have anyone else encountered this? What could be the problem?



Update #1: I have a server running on localhost:8080. When accessing from Safari I get the error message "Safari could not connect to the server". "http://localhost:8080/" works flawlessly in Firefox and Chrome.



Update #2: Same problem with "http://127.0.0.1:8080/" - so it does not seem to be related to resolving localhost to 127.0.0.1.










share|improve this question
















I've encountered a really strange Mac problem: Safari is unable to connect to localhost whereas all other applications can connect as normal (Firefox, Chrome, ping, etc.).



My /etc/hosts is the standard setup:



$ egrep localhost /etc/hosts
# localhost is used to configure the loopback interface
127.0.0.1 localhost
::1 localhost
fe80::1%lo0 localhost
127.0.0.1 testing.localhost


Question: Have anyone else encountered this? What could be the problem?



Update #1: I have a server running on localhost:8080. When accessing from Safari I get the error message "Safari could not connect to the server". "http://localhost:8080/" works flawlessly in Firefox and Chrome.



Update #2: Same problem with "http://127.0.0.1:8080/" - so it does not seem to be related to resolving localhost to 127.0.0.1.







mac safari localhost






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 27 '09 at 16:47







knorv

















asked Aug 27 '09 at 16:22









knorvknorv

2,64772222




2,64772222













  • Is there any remote chance your are using a proxy server?

    – BinaryMisfit
    Sep 3 '09 at 8:34











  • Diago: I'm not using a proxy server.

    – knorv
    Sep 4 '09 at 8:17






  • 1





    What's the http server running on localhost?

    – nagul
    Sep 6 '09 at 10:55






  • 1





    For the archives (see comments at grawity's answer), though it does not solve the question above: on my Mac OS X 10.6, with the /etc/hosts as above and IPv6 left at its default automatic, requesting 127.0.0.1:8080 makes Safari use IPv4 (which could still connect to a server providing IPv6). Requesting localhost:8080 makes Safari use IPv6.

    – Arjan
    Sep 7 '09 at 15:14











  • how about sniffing to see what the difference is between the two browsers' requests?

    – mihi
    Sep 8 '09 at 17:28



















  • Is there any remote chance your are using a proxy server?

    – BinaryMisfit
    Sep 3 '09 at 8:34











  • Diago: I'm not using a proxy server.

    – knorv
    Sep 4 '09 at 8:17






  • 1





    What's the http server running on localhost?

    – nagul
    Sep 6 '09 at 10:55






  • 1





    For the archives (see comments at grawity's answer), though it does not solve the question above: on my Mac OS X 10.6, with the /etc/hosts as above and IPv6 left at its default automatic, requesting 127.0.0.1:8080 makes Safari use IPv4 (which could still connect to a server providing IPv6). Requesting localhost:8080 makes Safari use IPv6.

    – Arjan
    Sep 7 '09 at 15:14











  • how about sniffing to see what the difference is between the two browsers' requests?

    – mihi
    Sep 8 '09 at 17:28

















Is there any remote chance your are using a proxy server?

– BinaryMisfit
Sep 3 '09 at 8:34





Is there any remote chance your are using a proxy server?

– BinaryMisfit
Sep 3 '09 at 8:34













Diago: I'm not using a proxy server.

– knorv
Sep 4 '09 at 8:17





Diago: I'm not using a proxy server.

– knorv
Sep 4 '09 at 8:17




1




1





What's the http server running on localhost?

– nagul
Sep 6 '09 at 10:55





What's the http server running on localhost?

– nagul
Sep 6 '09 at 10:55




1




1





For the archives (see comments at grawity's answer), though it does not solve the question above: on my Mac OS X 10.6, with the /etc/hosts as above and IPv6 left at its default automatic, requesting 127.0.0.1:8080 makes Safari use IPv4 (which could still connect to a server providing IPv6). Requesting localhost:8080 makes Safari use IPv6.

– Arjan
Sep 7 '09 at 15:14





For the archives (see comments at grawity's answer), though it does not solve the question above: on my Mac OS X 10.6, with the /etc/hosts as above and IPv6 left at its default automatic, requesting 127.0.0.1:8080 makes Safari use IPv4 (which could still connect to a server providing IPv6). Requesting localhost:8080 makes Safari use IPv6.

– Arjan
Sep 7 '09 at 15:14













how about sniffing to see what the difference is between the two browsers' requests?

– mihi
Sep 8 '09 at 17:28





how about sniffing to see what the difference is between the two browsers' requests?

– mihi
Sep 8 '09 at 17:28










8 Answers
8






active

oldest

votes


















4





+50









I think we need a little more information based on your question.



I'm going to guess you have a web server running to accept requests? I currently don't, and Safari won't connect to 127.0.0.1, because it "Couldn't find 127.0.0.1" - even though I can ping it just fine.



So first, you need to have something running. Secondly, have you tried connecting to testing.localhost with Safari, just incase the two entries are confusing Safari (this is entirely possible).



When you say "applications can connect as normal" with Chrome and Firefox, what are you seeing? The web page you're expecting to see? A different error?



Edit



I downloaded and installed MAMP, and I could not reproduce this error.



Some forum threads suggest IPv6 resolution is causing this issue. I would be inclined to turn off IPv6 and remove the entry from the hosts file (temporarily just for testing)




  1. Apple Menu > System Preferences

  2. Network

  3. Select your Network Connection > Advanced

  4. Configure IPv6 > Off


Apply, restart, and see how it goes.






share|improve this answer


























  • Thanks for the input. I've added a clarifying update to my post.

    – knorv
    Aug 27 '09 at 16:48






  • 1





    I had the same problem. I removed the IPv6 lines from /etc/hosts and it is working. Thanks for the hint.

    – tamasd
    Aug 21 '11 at 10:26



















2














I've had this happen before -- using http://computername.local/ worked for me, but I'm unsure why it would be different than just using a name in a host file.






share|improve this answer
























  • the problem might be that the connection to 127.0.0.1 goes through the interface lo0, whereas computername.local doesn't need to...

    – Atmocreations
    Sep 7 '09 at 17:01



















1














Comment out the line:



::1         localhost 


from your /etc/hosts file. Apparently this would be caused by IPv6 support in Safari.






share|improve this answer
























  • You may be right, but 127.0.0.1:8080 does not work either and I don't think that would rely on anything from the hosts file. (However, like EvilChookie answered: disabling IPV6 in the network settings may have a different result.)

    – Arjan
    Sep 7 '09 at 6:59



















1














Some applications decide to bind to only a single interface - 192.168.13.37, for example, if that is the address assigned to eth0 or such - instead of using 0.0.0.0 for all interfaces.



Others might be using only IPv6 addresses ::1 (localhost) or :: (all interfaces). Try http://[::1]:8080/ in this case.






share|improve this answer
























  • Interesting! The python -m SimpleHTTPServer 8080 does not support http://[::1]:8080/ but the built-in Apache (Web Sharing) does. (Though, if the application would only allow some address or some protocol, then wouldn't other browsers show the same problems while connecting?)

    – Arjan
    Sep 7 '09 at 8:04











  • Arjan: Maybe Safari first tries IPv4, gets "Connection Refused", and stops trying? I don't actually know.

    – grawity
    Sep 7 '09 at 11:11











  • When using Listen 8080 or Listen [::1]:8080 in Apache's /etc/apache2/httpd.conf then sudo lsof -i :8080 shows that httpd is using IPv6 only. Next, requesting 127.0.0.1:8080 in Safari makes lsof show Safari uses IPv4, but still connects fine. Using localhost:8080 makes Safari use IPv6. Likewise Listen 127.0.0.1:8080 only enables IPv4. But: Listen localhost:8080 makes httpd use BOTH IPv4 and IPv6. Still: Safari handles all, on my Mac. (I wonder if @knorv has issues when using Apache or Python rather than the server (s)he is using. And if changing something like Listen helps.)

    – Arjan
    Sep 7 '09 at 12:10



















0














i'm not going to answer your question directly, but offer an alternative solution: use virtualhostx to manage the local DNS. See also if MAMP is not a good solution for your local development needs (if that's what you're after).






share|improve this answer
























  • Sorry, but this is totally unrelated to my question. I'm not even using Apache.

    – knorv
    Sep 4 '09 at 8:18



















0














To ensure it's not an issue with your web server (like @nagul asked: what server are you using?), on my 10.6 Snow Leopard with IPv6 left at automatic, and even with 127.0.0.1 testing.localhost added to my /etc/hosts, the following works fine:




  • Change the Listen port of the built-in Apache from 80 to 8080:
    sudo vi /etc/apache2/httpd.conf

  • Run the built-in Apache by enabling System Preferences, Sharing, Web Sharing. Or restart using: sudo apachectl restart


Likewise, for me no problems using:




  • python -m SimpleHTTPServer 8080


I know you stated you're not using any proxy. Just in case there's any doubt: recent versions of Firefox allow you to choose between Firefox-specific network settings (which was the only option in older versions), and the system settings. Safari always uses the system settings. Of course, good proxy settings would ignore local addresses (defaults on my Mac for Bypass proxy settings for these Hosts & Domains: *.local, *.lan, 169.254/16). Still, one could check if Firefox still works when making it use the system settings just like Safari. (Firefox Preferences, Advanced, tab Network, button Settings.)



(Anything in the server logs or Console logs? Which version of Mac OS?)






share|improve this answer

































    0














    What's your DNS? some DNS providers like OpenDNS depends on your settings might prevent you from going somewhere, so to test it completely remove DNS and make sure you have no proxy configured as well






    share|improve this answer
























    • I doubt DNS can be an issue if 127.0.0.1:8080 does not work.

      – Arjan
      Sep 9 '09 at 22:20



















    -1














    it sounds like your server may not be running on the ip and port you're expecting. what is output when you run the following in a terminal?



    netstat -anp tcp | grep 8080


    you should see a line corresponding to your server. if no line appears, then your server may be running on a different port.






    share|improve this answer
























    • That would make it Quite A Wonder that other browsers work fine. ;-)

      – Arjan
      Sep 9 '09 at 16:59












    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "3"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f30827%2fsafari-is-unable-to-reach-localhost-127-0-0-1%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    8 Answers
    8






    active

    oldest

    votes








    8 Answers
    8






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    4





    +50









    I think we need a little more information based on your question.



    I'm going to guess you have a web server running to accept requests? I currently don't, and Safari won't connect to 127.0.0.1, because it "Couldn't find 127.0.0.1" - even though I can ping it just fine.



    So first, you need to have something running. Secondly, have you tried connecting to testing.localhost with Safari, just incase the two entries are confusing Safari (this is entirely possible).



    When you say "applications can connect as normal" with Chrome and Firefox, what are you seeing? The web page you're expecting to see? A different error?



    Edit



    I downloaded and installed MAMP, and I could not reproduce this error.



    Some forum threads suggest IPv6 resolution is causing this issue. I would be inclined to turn off IPv6 and remove the entry from the hosts file (temporarily just for testing)




    1. Apple Menu > System Preferences

    2. Network

    3. Select your Network Connection > Advanced

    4. Configure IPv6 > Off


    Apply, restart, and see how it goes.






    share|improve this answer


























    • Thanks for the input. I've added a clarifying update to my post.

      – knorv
      Aug 27 '09 at 16:48






    • 1





      I had the same problem. I removed the IPv6 lines from /etc/hosts and it is working. Thanks for the hint.

      – tamasd
      Aug 21 '11 at 10:26
















    4





    +50









    I think we need a little more information based on your question.



    I'm going to guess you have a web server running to accept requests? I currently don't, and Safari won't connect to 127.0.0.1, because it "Couldn't find 127.0.0.1" - even though I can ping it just fine.



    So first, you need to have something running. Secondly, have you tried connecting to testing.localhost with Safari, just incase the two entries are confusing Safari (this is entirely possible).



    When you say "applications can connect as normal" with Chrome and Firefox, what are you seeing? The web page you're expecting to see? A different error?



    Edit



    I downloaded and installed MAMP, and I could not reproduce this error.



    Some forum threads suggest IPv6 resolution is causing this issue. I would be inclined to turn off IPv6 and remove the entry from the hosts file (temporarily just for testing)




    1. Apple Menu > System Preferences

    2. Network

    3. Select your Network Connection > Advanced

    4. Configure IPv6 > Off


    Apply, restart, and see how it goes.






    share|improve this answer


























    • Thanks for the input. I've added a clarifying update to my post.

      – knorv
      Aug 27 '09 at 16:48






    • 1





      I had the same problem. I removed the IPv6 lines from /etc/hosts and it is working. Thanks for the hint.

      – tamasd
      Aug 21 '11 at 10:26














    4





    +50







    4





    +50



    4




    +50





    I think we need a little more information based on your question.



    I'm going to guess you have a web server running to accept requests? I currently don't, and Safari won't connect to 127.0.0.1, because it "Couldn't find 127.0.0.1" - even though I can ping it just fine.



    So first, you need to have something running. Secondly, have you tried connecting to testing.localhost with Safari, just incase the two entries are confusing Safari (this is entirely possible).



    When you say "applications can connect as normal" with Chrome and Firefox, what are you seeing? The web page you're expecting to see? A different error?



    Edit



    I downloaded and installed MAMP, and I could not reproduce this error.



    Some forum threads suggest IPv6 resolution is causing this issue. I would be inclined to turn off IPv6 and remove the entry from the hosts file (temporarily just for testing)




    1. Apple Menu > System Preferences

    2. Network

    3. Select your Network Connection > Advanced

    4. Configure IPv6 > Off


    Apply, restart, and see how it goes.






    share|improve this answer















    I think we need a little more information based on your question.



    I'm going to guess you have a web server running to accept requests? I currently don't, and Safari won't connect to 127.0.0.1, because it "Couldn't find 127.0.0.1" - even though I can ping it just fine.



    So first, you need to have something running. Secondly, have you tried connecting to testing.localhost with Safari, just incase the two entries are confusing Safari (this is entirely possible).



    When you say "applications can connect as normal" with Chrome and Firefox, what are you seeing? The web page you're expecting to see? A different error?



    Edit



    I downloaded and installed MAMP, and I could not reproduce this error.



    Some forum threads suggest IPv6 resolution is causing this issue. I would be inclined to turn off IPv6 and remove the entry from the hosts file (temporarily just for testing)




    1. Apple Menu > System Preferences

    2. Network

    3. Select your Network Connection > Advanced

    4. Configure IPv6 > Off


    Apply, restart, and see how it goes.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Aug 27 '09 at 18:36

























    answered Aug 27 '09 at 16:27









    EvilChookieEvilChookie

    4,35912034




    4,35912034













    • Thanks for the input. I've added a clarifying update to my post.

      – knorv
      Aug 27 '09 at 16:48






    • 1





      I had the same problem. I removed the IPv6 lines from /etc/hosts and it is working. Thanks for the hint.

      – tamasd
      Aug 21 '11 at 10:26



















    • Thanks for the input. I've added a clarifying update to my post.

      – knorv
      Aug 27 '09 at 16:48






    • 1





      I had the same problem. I removed the IPv6 lines from /etc/hosts and it is working. Thanks for the hint.

      – tamasd
      Aug 21 '11 at 10:26

















    Thanks for the input. I've added a clarifying update to my post.

    – knorv
    Aug 27 '09 at 16:48





    Thanks for the input. I've added a clarifying update to my post.

    – knorv
    Aug 27 '09 at 16:48




    1




    1





    I had the same problem. I removed the IPv6 lines from /etc/hosts and it is working. Thanks for the hint.

    – tamasd
    Aug 21 '11 at 10:26





    I had the same problem. I removed the IPv6 lines from /etc/hosts and it is working. Thanks for the hint.

    – tamasd
    Aug 21 '11 at 10:26













    2














    I've had this happen before -- using http://computername.local/ worked for me, but I'm unsure why it would be different than just using a name in a host file.






    share|improve this answer
























    • the problem might be that the connection to 127.0.0.1 goes through the interface lo0, whereas computername.local doesn't need to...

      – Atmocreations
      Sep 7 '09 at 17:01
















    2














    I've had this happen before -- using http://computername.local/ worked for me, but I'm unsure why it would be different than just using a name in a host file.






    share|improve this answer
























    • the problem might be that the connection to 127.0.0.1 goes through the interface lo0, whereas computername.local doesn't need to...

      – Atmocreations
      Sep 7 '09 at 17:01














    2












    2








    2







    I've had this happen before -- using http://computername.local/ worked for me, but I'm unsure why it would be different than just using a name in a host file.






    share|improve this answer













    I've had this happen before -- using http://computername.local/ worked for me, but I'm unsure why it would be different than just using a name in a host file.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Aug 27 '09 at 17:00









    ericvgericvg

    84151420




    84151420













    • the problem might be that the connection to 127.0.0.1 goes through the interface lo0, whereas computername.local doesn't need to...

      – Atmocreations
      Sep 7 '09 at 17:01



















    • the problem might be that the connection to 127.0.0.1 goes through the interface lo0, whereas computername.local doesn't need to...

      – Atmocreations
      Sep 7 '09 at 17:01

















    the problem might be that the connection to 127.0.0.1 goes through the interface lo0, whereas computername.local doesn't need to...

    – Atmocreations
    Sep 7 '09 at 17:01





    the problem might be that the connection to 127.0.0.1 goes through the interface lo0, whereas computername.local doesn't need to...

    – Atmocreations
    Sep 7 '09 at 17:01











    1














    Comment out the line:



    ::1         localhost 


    from your /etc/hosts file. Apparently this would be caused by IPv6 support in Safari.






    share|improve this answer
























    • You may be right, but 127.0.0.1:8080 does not work either and I don't think that would rely on anything from the hosts file. (However, like EvilChookie answered: disabling IPV6 in the network settings may have a different result.)

      – Arjan
      Sep 7 '09 at 6:59
















    1














    Comment out the line:



    ::1         localhost 


    from your /etc/hosts file. Apparently this would be caused by IPv6 support in Safari.






    share|improve this answer
























    • You may be right, but 127.0.0.1:8080 does not work either and I don't think that would rely on anything from the hosts file. (However, like EvilChookie answered: disabling IPV6 in the network settings may have a different result.)

      – Arjan
      Sep 7 '09 at 6:59














    1












    1








    1







    Comment out the line:



    ::1         localhost 


    from your /etc/hosts file. Apparently this would be caused by IPv6 support in Safari.






    share|improve this answer













    Comment out the line:



    ::1         localhost 


    from your /etc/hosts file. Apparently this would be caused by IPv6 support in Safari.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Sep 7 '09 at 6:44









    SnarkSnark

    29.2k67689




    29.2k67689













    • You may be right, but 127.0.0.1:8080 does not work either and I don't think that would rely on anything from the hosts file. (However, like EvilChookie answered: disabling IPV6 in the network settings may have a different result.)

      – Arjan
      Sep 7 '09 at 6:59



















    • You may be right, but 127.0.0.1:8080 does not work either and I don't think that would rely on anything from the hosts file. (However, like EvilChookie answered: disabling IPV6 in the network settings may have a different result.)

      – Arjan
      Sep 7 '09 at 6:59

















    You may be right, but 127.0.0.1:8080 does not work either and I don't think that would rely on anything from the hosts file. (However, like EvilChookie answered: disabling IPV6 in the network settings may have a different result.)

    – Arjan
    Sep 7 '09 at 6:59





    You may be right, but 127.0.0.1:8080 does not work either and I don't think that would rely on anything from the hosts file. (However, like EvilChookie answered: disabling IPV6 in the network settings may have a different result.)

    – Arjan
    Sep 7 '09 at 6:59











    1














    Some applications decide to bind to only a single interface - 192.168.13.37, for example, if that is the address assigned to eth0 or such - instead of using 0.0.0.0 for all interfaces.



    Others might be using only IPv6 addresses ::1 (localhost) or :: (all interfaces). Try http://[::1]:8080/ in this case.






    share|improve this answer
























    • Interesting! The python -m SimpleHTTPServer 8080 does not support http://[::1]:8080/ but the built-in Apache (Web Sharing) does. (Though, if the application would only allow some address or some protocol, then wouldn't other browsers show the same problems while connecting?)

      – Arjan
      Sep 7 '09 at 8:04











    • Arjan: Maybe Safari first tries IPv4, gets "Connection Refused", and stops trying? I don't actually know.

      – grawity
      Sep 7 '09 at 11:11











    • When using Listen 8080 or Listen [::1]:8080 in Apache's /etc/apache2/httpd.conf then sudo lsof -i :8080 shows that httpd is using IPv6 only. Next, requesting 127.0.0.1:8080 in Safari makes lsof show Safari uses IPv4, but still connects fine. Using localhost:8080 makes Safari use IPv6. Likewise Listen 127.0.0.1:8080 only enables IPv4. But: Listen localhost:8080 makes httpd use BOTH IPv4 and IPv6. Still: Safari handles all, on my Mac. (I wonder if @knorv has issues when using Apache or Python rather than the server (s)he is using. And if changing something like Listen helps.)

      – Arjan
      Sep 7 '09 at 12:10
















    1














    Some applications decide to bind to only a single interface - 192.168.13.37, for example, if that is the address assigned to eth0 or such - instead of using 0.0.0.0 for all interfaces.



    Others might be using only IPv6 addresses ::1 (localhost) or :: (all interfaces). Try http://[::1]:8080/ in this case.






    share|improve this answer
























    • Interesting! The python -m SimpleHTTPServer 8080 does not support http://[::1]:8080/ but the built-in Apache (Web Sharing) does. (Though, if the application would only allow some address or some protocol, then wouldn't other browsers show the same problems while connecting?)

      – Arjan
      Sep 7 '09 at 8:04











    • Arjan: Maybe Safari first tries IPv4, gets "Connection Refused", and stops trying? I don't actually know.

      – grawity
      Sep 7 '09 at 11:11











    • When using Listen 8080 or Listen [::1]:8080 in Apache's /etc/apache2/httpd.conf then sudo lsof -i :8080 shows that httpd is using IPv6 only. Next, requesting 127.0.0.1:8080 in Safari makes lsof show Safari uses IPv4, but still connects fine. Using localhost:8080 makes Safari use IPv6. Likewise Listen 127.0.0.1:8080 only enables IPv4. But: Listen localhost:8080 makes httpd use BOTH IPv4 and IPv6. Still: Safari handles all, on my Mac. (I wonder if @knorv has issues when using Apache or Python rather than the server (s)he is using. And if changing something like Listen helps.)

      – Arjan
      Sep 7 '09 at 12:10














    1












    1








    1







    Some applications decide to bind to only a single interface - 192.168.13.37, for example, if that is the address assigned to eth0 or such - instead of using 0.0.0.0 for all interfaces.



    Others might be using only IPv6 addresses ::1 (localhost) or :: (all interfaces). Try http://[::1]:8080/ in this case.






    share|improve this answer













    Some applications decide to bind to only a single interface - 192.168.13.37, for example, if that is the address assigned to eth0 or such - instead of using 0.0.0.0 for all interfaces.



    Others might be using only IPv6 addresses ::1 (localhost) or :: (all interfaces). Try http://[::1]:8080/ in this case.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Sep 7 '09 at 7:45









    grawitygrawity

    243k37513570




    243k37513570













    • Interesting! The python -m SimpleHTTPServer 8080 does not support http://[::1]:8080/ but the built-in Apache (Web Sharing) does. (Though, if the application would only allow some address or some protocol, then wouldn't other browsers show the same problems while connecting?)

      – Arjan
      Sep 7 '09 at 8:04











    • Arjan: Maybe Safari first tries IPv4, gets "Connection Refused", and stops trying? I don't actually know.

      – grawity
      Sep 7 '09 at 11:11











    • When using Listen 8080 or Listen [::1]:8080 in Apache's /etc/apache2/httpd.conf then sudo lsof -i :8080 shows that httpd is using IPv6 only. Next, requesting 127.0.0.1:8080 in Safari makes lsof show Safari uses IPv4, but still connects fine. Using localhost:8080 makes Safari use IPv6. Likewise Listen 127.0.0.1:8080 only enables IPv4. But: Listen localhost:8080 makes httpd use BOTH IPv4 and IPv6. Still: Safari handles all, on my Mac. (I wonder if @knorv has issues when using Apache or Python rather than the server (s)he is using. And if changing something like Listen helps.)

      – Arjan
      Sep 7 '09 at 12:10



















    • Interesting! The python -m SimpleHTTPServer 8080 does not support http://[::1]:8080/ but the built-in Apache (Web Sharing) does. (Though, if the application would only allow some address or some protocol, then wouldn't other browsers show the same problems while connecting?)

      – Arjan
      Sep 7 '09 at 8:04











    • Arjan: Maybe Safari first tries IPv4, gets "Connection Refused", and stops trying? I don't actually know.

      – grawity
      Sep 7 '09 at 11:11











    • When using Listen 8080 or Listen [::1]:8080 in Apache's /etc/apache2/httpd.conf then sudo lsof -i :8080 shows that httpd is using IPv6 only. Next, requesting 127.0.0.1:8080 in Safari makes lsof show Safari uses IPv4, but still connects fine. Using localhost:8080 makes Safari use IPv6. Likewise Listen 127.0.0.1:8080 only enables IPv4. But: Listen localhost:8080 makes httpd use BOTH IPv4 and IPv6. Still: Safari handles all, on my Mac. (I wonder if @knorv has issues when using Apache or Python rather than the server (s)he is using. And if changing something like Listen helps.)

      – Arjan
      Sep 7 '09 at 12:10

















    Interesting! The python -m SimpleHTTPServer 8080 does not support http://[::1]:8080/ but the built-in Apache (Web Sharing) does. (Though, if the application would only allow some address or some protocol, then wouldn't other browsers show the same problems while connecting?)

    – Arjan
    Sep 7 '09 at 8:04





    Interesting! The python -m SimpleHTTPServer 8080 does not support http://[::1]:8080/ but the built-in Apache (Web Sharing) does. (Though, if the application would only allow some address or some protocol, then wouldn't other browsers show the same problems while connecting?)

    – Arjan
    Sep 7 '09 at 8:04













    Arjan: Maybe Safari first tries IPv4, gets "Connection Refused", and stops trying? I don't actually know.

    – grawity
    Sep 7 '09 at 11:11





    Arjan: Maybe Safari first tries IPv4, gets "Connection Refused", and stops trying? I don't actually know.

    – grawity
    Sep 7 '09 at 11:11













    When using Listen 8080 or Listen [::1]:8080 in Apache's /etc/apache2/httpd.conf then sudo lsof -i :8080 shows that httpd is using IPv6 only. Next, requesting 127.0.0.1:8080 in Safari makes lsof show Safari uses IPv4, but still connects fine. Using localhost:8080 makes Safari use IPv6. Likewise Listen 127.0.0.1:8080 only enables IPv4. But: Listen localhost:8080 makes httpd use BOTH IPv4 and IPv6. Still: Safari handles all, on my Mac. (I wonder if @knorv has issues when using Apache or Python rather than the server (s)he is using. And if changing something like Listen helps.)

    – Arjan
    Sep 7 '09 at 12:10





    When using Listen 8080 or Listen [::1]:8080 in Apache's /etc/apache2/httpd.conf then sudo lsof -i :8080 shows that httpd is using IPv6 only. Next, requesting 127.0.0.1:8080 in Safari makes lsof show Safari uses IPv4, but still connects fine. Using localhost:8080 makes Safari use IPv6. Likewise Listen 127.0.0.1:8080 only enables IPv4. But: Listen localhost:8080 makes httpd use BOTH IPv4 and IPv6. Still: Safari handles all, on my Mac. (I wonder if @knorv has issues when using Apache or Python rather than the server (s)he is using. And if changing something like Listen helps.)

    – Arjan
    Sep 7 '09 at 12:10











    0














    i'm not going to answer your question directly, but offer an alternative solution: use virtualhostx to manage the local DNS. See also if MAMP is not a good solution for your local development needs (if that's what you're after).






    share|improve this answer
























    • Sorry, but this is totally unrelated to my question. I'm not even using Apache.

      – knorv
      Sep 4 '09 at 8:18
















    0














    i'm not going to answer your question directly, but offer an alternative solution: use virtualhostx to manage the local DNS. See also if MAMP is not a good solution for your local development needs (if that's what you're after).






    share|improve this answer
























    • Sorry, but this is totally unrelated to my question. I'm not even using Apache.

      – knorv
      Sep 4 '09 at 8:18














    0












    0








    0







    i'm not going to answer your question directly, but offer an alternative solution: use virtualhostx to manage the local DNS. See also if MAMP is not a good solution for your local development needs (if that's what you're after).






    share|improve this answer













    i'm not going to answer your question directly, but offer an alternative solution: use virtualhostx to manage the local DNS. See also if MAMP is not a good solution for your local development needs (if that's what you're after).







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Sep 3 '09 at 11:43









    pixelinepixeline

    2581414




    2581414













    • Sorry, but this is totally unrelated to my question. I'm not even using Apache.

      – knorv
      Sep 4 '09 at 8:18



















    • Sorry, but this is totally unrelated to my question. I'm not even using Apache.

      – knorv
      Sep 4 '09 at 8:18

















    Sorry, but this is totally unrelated to my question. I'm not even using Apache.

    – knorv
    Sep 4 '09 at 8:18





    Sorry, but this is totally unrelated to my question. I'm not even using Apache.

    – knorv
    Sep 4 '09 at 8:18











    0














    To ensure it's not an issue with your web server (like @nagul asked: what server are you using?), on my 10.6 Snow Leopard with IPv6 left at automatic, and even with 127.0.0.1 testing.localhost added to my /etc/hosts, the following works fine:




    • Change the Listen port of the built-in Apache from 80 to 8080:
      sudo vi /etc/apache2/httpd.conf

    • Run the built-in Apache by enabling System Preferences, Sharing, Web Sharing. Or restart using: sudo apachectl restart


    Likewise, for me no problems using:




    • python -m SimpleHTTPServer 8080


    I know you stated you're not using any proxy. Just in case there's any doubt: recent versions of Firefox allow you to choose between Firefox-specific network settings (which was the only option in older versions), and the system settings. Safari always uses the system settings. Of course, good proxy settings would ignore local addresses (defaults on my Mac for Bypass proxy settings for these Hosts & Domains: *.local, *.lan, 169.254/16). Still, one could check if Firefox still works when making it use the system settings just like Safari. (Firefox Preferences, Advanced, tab Network, button Settings.)



    (Anything in the server logs or Console logs? Which version of Mac OS?)






    share|improve this answer






























      0














      To ensure it's not an issue with your web server (like @nagul asked: what server are you using?), on my 10.6 Snow Leopard with IPv6 left at automatic, and even with 127.0.0.1 testing.localhost added to my /etc/hosts, the following works fine:




      • Change the Listen port of the built-in Apache from 80 to 8080:
        sudo vi /etc/apache2/httpd.conf

      • Run the built-in Apache by enabling System Preferences, Sharing, Web Sharing. Or restart using: sudo apachectl restart


      Likewise, for me no problems using:




      • python -m SimpleHTTPServer 8080


      I know you stated you're not using any proxy. Just in case there's any doubt: recent versions of Firefox allow you to choose between Firefox-specific network settings (which was the only option in older versions), and the system settings. Safari always uses the system settings. Of course, good proxy settings would ignore local addresses (defaults on my Mac for Bypass proxy settings for these Hosts & Domains: *.local, *.lan, 169.254/16). Still, one could check if Firefox still works when making it use the system settings just like Safari. (Firefox Preferences, Advanced, tab Network, button Settings.)



      (Anything in the server logs or Console logs? Which version of Mac OS?)






      share|improve this answer




























        0












        0








        0







        To ensure it's not an issue with your web server (like @nagul asked: what server are you using?), on my 10.6 Snow Leopard with IPv6 left at automatic, and even with 127.0.0.1 testing.localhost added to my /etc/hosts, the following works fine:




        • Change the Listen port of the built-in Apache from 80 to 8080:
          sudo vi /etc/apache2/httpd.conf

        • Run the built-in Apache by enabling System Preferences, Sharing, Web Sharing. Or restart using: sudo apachectl restart


        Likewise, for me no problems using:




        • python -m SimpleHTTPServer 8080


        I know you stated you're not using any proxy. Just in case there's any doubt: recent versions of Firefox allow you to choose between Firefox-specific network settings (which was the only option in older versions), and the system settings. Safari always uses the system settings. Of course, good proxy settings would ignore local addresses (defaults on my Mac for Bypass proxy settings for these Hosts & Domains: *.local, *.lan, 169.254/16). Still, one could check if Firefox still works when making it use the system settings just like Safari. (Firefox Preferences, Advanced, tab Network, button Settings.)



        (Anything in the server logs or Console logs? Which version of Mac OS?)






        share|improve this answer















        To ensure it's not an issue with your web server (like @nagul asked: what server are you using?), on my 10.6 Snow Leopard with IPv6 left at automatic, and even with 127.0.0.1 testing.localhost added to my /etc/hosts, the following works fine:




        • Change the Listen port of the built-in Apache from 80 to 8080:
          sudo vi /etc/apache2/httpd.conf

        • Run the built-in Apache by enabling System Preferences, Sharing, Web Sharing. Or restart using: sudo apachectl restart


        Likewise, for me no problems using:




        • python -m SimpleHTTPServer 8080


        I know you stated you're not using any proxy. Just in case there's any doubt: recent versions of Firefox allow you to choose between Firefox-specific network settings (which was the only option in older versions), and the system settings. Safari always uses the system settings. Of course, good proxy settings would ignore local addresses (defaults on my Mac for Bypass proxy settings for these Hosts & Domains: *.local, *.lan, 169.254/16). Still, one could check if Firefox still works when making it use the system settings just like Safari. (Firefox Preferences, Advanced, tab Network, button Settings.)



        (Anything in the server logs or Console logs? Which version of Mac OS?)







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Sep 7 '09 at 9:11

























        answered Sep 7 '09 at 7:27









        ArjanArjan

        27k1065107




        27k1065107























            0














            What's your DNS? some DNS providers like OpenDNS depends on your settings might prevent you from going somewhere, so to test it completely remove DNS and make sure you have no proxy configured as well






            share|improve this answer
























            • I doubt DNS can be an issue if 127.0.0.1:8080 does not work.

              – Arjan
              Sep 9 '09 at 22:20
















            0














            What's your DNS? some DNS providers like OpenDNS depends on your settings might prevent you from going somewhere, so to test it completely remove DNS and make sure you have no proxy configured as well






            share|improve this answer
























            • I doubt DNS can be an issue if 127.0.0.1:8080 does not work.

              – Arjan
              Sep 9 '09 at 22:20














            0












            0








            0







            What's your DNS? some DNS providers like OpenDNS depends on your settings might prevent you from going somewhere, so to test it completely remove DNS and make sure you have no proxy configured as well






            share|improve this answer













            What's your DNS? some DNS providers like OpenDNS depends on your settings might prevent you from going somewhere, so to test it completely remove DNS and make sure you have no proxy configured as well







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Sep 9 '09 at 3:40









            alexusalexus

            1,65473556




            1,65473556













            • I doubt DNS can be an issue if 127.0.0.1:8080 does not work.

              – Arjan
              Sep 9 '09 at 22:20



















            • I doubt DNS can be an issue if 127.0.0.1:8080 does not work.

              – Arjan
              Sep 9 '09 at 22:20

















            I doubt DNS can be an issue if 127.0.0.1:8080 does not work.

            – Arjan
            Sep 9 '09 at 22:20





            I doubt DNS can be an issue if 127.0.0.1:8080 does not work.

            – Arjan
            Sep 9 '09 at 22:20











            -1














            it sounds like your server may not be running on the ip and port you're expecting. what is output when you run the following in a terminal?



            netstat -anp tcp | grep 8080


            you should see a line corresponding to your server. if no line appears, then your server may be running on a different port.






            share|improve this answer
























            • That would make it Quite A Wonder that other browsers work fine. ;-)

              – Arjan
              Sep 9 '09 at 16:59
















            -1














            it sounds like your server may not be running on the ip and port you're expecting. what is output when you run the following in a terminal?



            netstat -anp tcp | grep 8080


            you should see a line corresponding to your server. if no line appears, then your server may be running on a different port.






            share|improve this answer
























            • That would make it Quite A Wonder that other browsers work fine. ;-)

              – Arjan
              Sep 9 '09 at 16:59














            -1












            -1








            -1







            it sounds like your server may not be running on the ip and port you're expecting. what is output when you run the following in a terminal?



            netstat -anp tcp | grep 8080


            you should see a line corresponding to your server. if no line appears, then your server may be running on a different port.






            share|improve this answer













            it sounds like your server may not be running on the ip and port you're expecting. what is output when you run the following in a terminal?



            netstat -anp tcp | grep 8080


            you should see a line corresponding to your server. if no line appears, then your server may be running on a different port.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Sep 9 '09 at 3:37









            aaronaaron

            3112420




            3112420













            • That would make it Quite A Wonder that other browsers work fine. ;-)

              – Arjan
              Sep 9 '09 at 16:59



















            • That would make it Quite A Wonder that other browsers work fine. ;-)

              – Arjan
              Sep 9 '09 at 16:59

















            That would make it Quite A Wonder that other browsers work fine. ;-)

            – Arjan
            Sep 9 '09 at 16:59





            That would make it Quite A Wonder that other browsers work fine. ;-)

            – Arjan
            Sep 9 '09 at 16:59


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Super User!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f30827%2fsafari-is-unable-to-reach-localhost-127-0-0-1%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Probability when a professor distributes a quiz and homework assignment to a class of n students.

            Aardman Animations

            Are they similar matrix