port numbers with cookies?

 
Post new topic   Reply to topic    Aprelium Forum Index -> FastCGI/CGI
View previous topic :: View next topic  
Author Message
derekn
-


Joined: 03 Oct 2005
Posts: 11

PostPosted: Sat Dec 24, 2005 6:14 am    Post subject: port numbers with cookies? Reply with quote

I have a free dynamic domain name thing (ex, mysite.dyndns.com), and here is what I am doing: I have 2 web sites, abyss on computer 1, abyss on computer 2. Computer 1 is port 80 on LAN to WAN, so http://mysite.dyndns.com takes you to computer 1, then computer 2 hosts on port 81, so http://mysite.dyndns.com:81 takes you to computer 2. Now, I am using cookies for login authentication. It works fine when setting cookies for local URLs (eg, 192.168.0.100, 192.168.0.101) and also works fine when logging in on http://mysite.dyndns.com. However, when I go to log in on computer 2 from outside (eg, http://mysite.dyndns.com:81), it will NOT authenticate.

My question is simple: can you use port numbers like this when setting the cookie? (I am using Perl to do this script, by the way)

Thanks,
Derek
Back to top View user's profile Send private message
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Sat Dec 24, 2005 7:07 am    Post subject: Reply with quote

The one with the port number is a totally different address. You would have
to use the one with the port at the end to set another cookie. Both of these
addresses are different, that's exactly why you see this behavior.

Sincerely, TRUSTpunk
Back to top View user's profile Send private message Visit poster's website
derekn
-


Joined: 03 Oct 2005
Posts: 11

PostPosted: Sat Dec 24, 2005 8:27 am    Post subject: Reply with quote

TRUSTpunk wrote:
The one with the port number is a totally different address. You would have
to use the one with the port at the end to set another cookie. Both of these
addresses are different, that's exactly why you see this behavior.

Sincerely, TRUSTpunk


use CGI qw/:standard/;

#var for dynamic IP use
$URL_obj="$ENV{'HTTP_HOST'}";

the $URL_obj is used in the my $setcookie function so that regardless of where the person is authenticating from, it still reflects the same page.
Back to top View user's profile Send private message
MonkeyNation
-


Joined: 05 Feb 2005
Posts: 921
Location: Cardiff

PostPosted: Sat Dec 24, 2005 9:06 am    Post subject: Reply with quote

derekn wrote:
TRUSTpunk wrote:
The one with the port number is a totally different address. You would have
to use the one with the port at the end to set another cookie. Both of these
addresses are different, that's exactly why you see this behavior.

Sincerely, TRUSTpunk


use CGI qw/:standard/;

#var for dynamic IP use
$URL_obj="$ENV{'HTTP_HOST'}";

the $URL_obj is used in the my $setcookie function so that regardless of where the person is authenticating from, it still reflects the same page.


Why don't you add a port number to it then? (Assuming you're after the two cookies, two sites thing.)
_________________
Back to top View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number
derekn
-


Joined: 03 Oct 2005
Posts: 11

PostPosted: Sat Dec 24, 2005 9:09 am    Post subject: Reply with quote

MonkeyNation wrote:
derekn wrote:
TRUSTpunk wrote:
The one with the port number is a totally different address. You would have
to use the one with the port at the end to set another cookie. Both of these
addresses are different, that's exactly why you see this behavior.

Sincerely, TRUSTpunk


use CGI qw/:standard/;

#var for dynamic IP use
$URL_obj="$ENV{'HTTP_HOST'}";

the $URL_obj is used in the my $setcookie function so that regardless of where the person is authenticating from, it still reflects the same page.


Why don't you add a port number to it then? (Assuming you're after the two cookies, two sites thing.)

That is exactly what is going on;
i write the cookie, and if the script is called from the url "http://mysite.dyndns.com:81" then the login script prints a cookie with that data in it, and then prints a location header for the requested URL. I think the cookie is not being written, otherwise the index.cgi script would be picking up the cgi values and you would then be logged in.
Hope that makes sense
Back to top View user's profile Send private message
derekn
-


Joined: 03 Oct 2005
Posts: 11

PostPosted: Sat Dec 24, 2005 9:11 am    Post subject: Reply with quote

right after i posted the last time, i took out the "domain" parameter on the cookie variable, and now it works! Go figure!
Back to top View user's profile Send private message
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Sat Dec 24, 2005 9:12 am    Post subject: Reply with quote

Im glad you got it working, I didn't really know how to explain the
situation to you. Anyway it's good that it's working now. LateR!
Back to top View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> FastCGI/CGI All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group