Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > 127.0.0.1 & machinename.local & http://localhost driving me nuts

127.0.0.1 & machinename.local & http://localhost driving me nuts
Thread Tools
Forum Regular
Join Date: Aug 2001
Status: Offline
Reply With Quote
Oct 14, 2003, 04:13 AM
 
I am developing a PHP app on my local machine, have done so for a year or two no with no problems. For some reason now I am running into really strange problems with http://127.0.0.1/file.php resolving as http://mymachinename.local/file.php! No big deal right? Wrong, since the app uses sessions, the cookie domain must be consistant, so the domains going back and forwards causes me too lose the session cookie. It's really sporadic too, I can't seem to pinpoint what causes the address to resolve as .local

Any thoughts? I want 127.0.0.1 to resolve to 127.0.0.1, no ands ifs or buts about it.
     
Mac Enthusiast
Join Date: Nov 2001
Location: Finland
Status: Offline
Reply With Quote
Oct 14, 2003, 04:21 AM
 
Originally posted by jetta_gt:
I am developing a PHP app on my local machine, have done so for a year or two no with no problems. For some reason now I am running into really strange problems with http://127.0.0.1/file.php resolving as http://mymachinename.local/file.php! No big deal right? Wrong, since the app uses sessions, the cookie domain must be consistant, so the domains going back and forwards causes me too lose the session cookie. It's really sporadic too, I can't seem to pinpoint what causes the address to resolve as .local

Any thoughts? I want 127.0.0.1 to resolve to 127.0.0.1, no ands ifs or buts about it.

Do you use any proxy servers? If you are try to add exceptions in the network settings preferences "proxy tab".
Example: localhost, 127.0.0.*
     
Occasionally Useful
Join Date: Jun 2001
Location: Liverpool, UK
Status: Offline
Reply With Quote
Oct 14, 2003, 04:56 AM
 
how about specifying 127.0.0.1 as the ServerName in your httpd.conf? worth a shot. obviously, you'll need to reboot the server app afterwards, but i'm sure you know that
"Have sharp knives. Be creative. Cook to music" ~ maxelson
     
Forum Regular
Join Date: Apr 2001
Status: Offline
Reply With Quote
Oct 14, 2003, 05:21 AM
 
Try:
Applications > Utilities > Directory Access

...uncheck the Rendezvous box in the "Services" tab.
     
Mac Elite
Join Date: May 2001
Status: Offline
Reply With Quote
Oct 14, 2003, 02:13 PM
 
If it's only a session cookie, make your whatever work without that cookie and have less problems overall.

-
     
Banned
Join Date: Apr 2002
Location: -
Status: Offline
Reply With Quote
Oct 14, 2003, 02:24 PM
 
don't forget to sudo apachectl graceful!
     
Fresh-Faced Recruit
Join Date: Aug 2002
Location: London, UK
Status: Offline
Reply With Quote
Oct 14, 2003, 03:56 PM
 
Not sure if this will be of any help, but I seem to remember similar weird behaviour when working on local dev sites and it appeared to be related to whether a link included the trailing / in the url. Try experimenting and seeing if that has anything to do with it - or I might just be barking up the wrong tree.

Edit: Just took the time to actually read your post and realised that your referencing a file not a directory (with an index.php etc. in it) so my hint probably isn't very helpful

That'll teach me to post after a few pints
(Last edited by tru322; Oct 14, 2003 at 05:10 PM. )
     
Forum Regular
Join Date: Aug 2001
Status: Offline
Reply With Quote
Oct 14, 2003, 05:20 PM
 
Thanks everyone for you advice, in the end it was actually tru322's advice that seemed to help a lot, although I learned something from every reply, thanks guys, very helpful!!!
     
Senior User
Join Date: Jan 2001
Location: california
Status: Offline
Reply With Quote
Oct 14, 2003, 06:51 PM
 
in /etc/httpd/httpd.conf you probably want to change UseCanonicalName to "off"

here's the description from httpd.conf:
# UseCanonicalName: (new for 1.3) With this setting turned on, whenever
# Apache needs to construct a self-referencing URL (a URL that refers back
# to the server the response is coming from) it will use ServerName and
# Port to form a "canonical" name. With this setting off, Apache will
# use the hostname:port that the client supplied, when possible. This
# also affects SERVER_NAME and SERVER_PORT in CGI scripts.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:58 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2