Forum OpenACS Development: making cookies on host node mappings work with ForceHostP and there's a CookieDomain setting

When dealing with host node mappings and the acs-kernel parameter ForceHostP is set to 1 and CookieDomain is not empty, there's this bug where the APIs fetch the value of CookieDomain and pass that around, ultimately ending in ad_set_cookie with a non-empty -domain parameter. This is buggy since we want to be able to issue cookies based on the hostname if they are mapped to a node.

A simple solution is copying the chunk of code inside rp_filter that determines if a host is a node mapping and resetting the $domain variable inside ad_set_cookie to blank when necessary.

We are currently using the above approach on a client site that responds to two main domains and several host node mappings and it works without problems so far.

Is there enough interest to warrant a TIP? Or is this a confirmed bug and I should just submit a patch or do the edits on HEAD?

Deds,

Based on these[1,2] descriptions, the symptom is a bug, because ForeHostP has to be set to 1 to prevent confusing login states when users browse a website.

However, doesn't this[3] discussion about browser confusion suggest that this particular problem should be addressed by setting the $domain variable to a specific (host node) domain instead of blank to handle cases where the user browses to multiple domains within the host node mapping, or does setting $domain blank handle this case in a manner that is not confusing to users?

1. https://openacs.org/forums/message-view?message_id=34294
2. https://openacs.org/doc/subsites-design.html
3. https://openacs.org/forums/message-view?message_id=103972

Deds, was this resolved in cvs Head?
No, its not fixed. Should be fixed based on the host node mapping. I guess add a new setting in host node map for the canonical host name for that node, and the others would redirect to that one.

Dave, wouldn't it be reasonable to assume that the host-node mapped domain would be the default SystemURL for each node?

ie, if these are mapped:

maindomain/subsite1  -- > nodedomain1
maindomain/subsite2 -- > www.nodedomain2

then www.nodedomain1 would redirect to nodedomain1 and nodedomain2 would redirect to www.nodedomain2 as if the mapped domains had the significance of the kernel's parameter SystemURL in the context of host nodes. No need to modify mappings sql.

Deds, could you post your code changes somewhere or send to me?

I'd like to get this issue solved and am willing to work around any constraints that prevent it from being added.

Torben,

Here's the patch against head (acs-tcl/tcl/utilities-procs.tcl)

*** utilities-procs.tcl	2009-11-27 17:33:59.000000000 +0800
--- utilities-procs-patched.tcl	2009-11-27 17:45:22.000000000 +0800
***************
*** 1932,1937 ****
--- 1932,1942 ----
          append cookie "; Expires=Tue, 01-Jan-1980 01:00:00 GMT"
      }
  
+     set root [root_of_host [ad_host]]
+     if { $root ne "" } {
+         set domain ""
+     }
+ 
      if { $domain ne "" } {
  	append cookie "; Domain=$domain"
      }