View previous topic :: View next topic |
Author |
Message |
derekn -
Joined: 03 Oct 2005 Posts: 11
|
Posted: Sat Dec 24, 2005 6:14 am Post subject: port numbers with cookies? |
|
|
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 |
|
|
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Sat Dec 24, 2005 7:07 am Post subject: |
|
|
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 |
|
|
derekn -
Joined: 03 Oct 2005 Posts: 11
|
Posted: Sat Dec 24, 2005 8:27 am Post subject: |
|
|
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 |
|
|
MonkeyNation -
Joined: 05 Feb 2005 Posts: 921 Location: Cardiff
|
Posted: Sat Dec 24, 2005 9:06 am Post subject: |
|
|
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 |
|
|
derekn -
Joined: 03 Oct 2005 Posts: 11
|
Posted: Sat Dec 24, 2005 9:09 am Post subject: |
|
|
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 |
|
|
derekn -
Joined: 03 Oct 2005 Posts: 11
|
Posted: Sat Dec 24, 2005 9:11 am Post subject: |
|
|
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 |
|
|
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Sat Dec 24, 2005 9:12 am Post subject: |
|
|
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 |
|
|
|