The way to handle this in IIS is to setup a new website that responds to 
requests made to “domain.com” only – leave your current website setup to 
respond to “www.domain.com”



Now, on this new site, make a TAF file that redirects to the other site. Use 
code like this to keep the path and arguments



<@ASSIGN request$httpHeader "HTTP/1.1 301 Moved Permanently<@CRLF>Location: 
http://www.{domain.com}/<@REPLACE str=<@HTTPATTRIBUTE http_search_args> 
findstr='404;http://{domain.com}:80/' replacestr=''><@CRLF><@CRLF>">



The trick to getting this to work is to adjust the 404 error to point to that 
TAF. To do this, edit the site, go to the Custom Errors tab (I’m assuming IIS 6 
here, IIS 7.x can also be setup this way), find the HTTP Error “404” Edit… it 
and change the Message type to URL and set the URL to /redirect.taf (assuming 
that the file you created above is named “redirect.taf”)



So now what will happen is that all requests to domain.com will be handled by 
this site, but this site has no files, so all requests will be 404s, but 404 
errors will be passed to your TAF which will respond a 301 Moved httpheader, 
adding the ‘www.’ and keeping the path, file and search arguments from the 
original request.



Hope that helps,



Robert



From: WebDude [mailto:[email protected]]
Sent: Tuesday, October 16, 2012 7:43 AM
To: [email protected]
Subject: RE: TeraScript-Talk: USERREFERENCE



Yes... we are uing IIS.









  _____

From: Robert Shubert [mailto:[email protected]]
Sent: Monday, October 15, 2012 11:21 AM
To: [email protected]
Subject: RE: TeraScript-Talk: USERREFERENCE

Yes, but please confirm that you are using IIS, as the setting depend on the 
web server. Robert



From: WebDude [mailto:[email protected]]
Sent: Monday, October 15, 2012 8:47 AM
To: [email protected]
Subject: RE: TeraScript-Talk: USERREFERENCE



"It’s also possible to change a user’s domain seamlessly, and keep the rest of 
the URL, fairly easily."



Could you elaborate on this?



Thanks!









  _____

From: Robert Shubert [mailto:[email protected]]
Sent: Friday, October 12, 2012 4:03 PM
To: [email protected]
Subject: RE: TeraScript-Talk: USERREFERENCE

This is certainly possible.



But this isn’t any different, really, than Bill’s suggestion. You’re just doing 
a redirection at a different point.



It’s also possible to change a user’s domain seamlessly, and keep the rest of 
the URL, fairly easily.



Robert







From: WebDude [mailto:[email protected]]
Sent: Friday, October 12, 2012 3:32 PM
To: [email protected]
Subject: RE: TeraScript-Talk: USERREFERENCE



The user needs to login to get to the applications. Do you see a downside to 
just have the first post (when checking their login id and password, to post 
the full abslolute path to either www or non www and use a hidden argument that 
passes the userreference regardless of how the site was accessed?



I other words, instead of

<FORM METHOD="POST" ACTION="index.taf?go=go">



Do a <FORM METHOD="POST" ACTION="http://www.mydomain.com/index.taf?go=go";>







That way, every subsequest page they request would be correct using www. There 
are no absolute links in the entire program. All links are...



<@APPFILE>? ya da ya da ya da..



I know this may blow away some bookmarks, but I am not sure that would be a big 
deal right now.







  _____

From: Robert Shubert [mailto:[email protected]]
Sent: Friday, October 12, 2012 2:07 PM
To: [email protected]
Subject: RE: TeraScript-Talk: USERREFERENCE

For security reasons it’s not automatically possible, nor recommended, to do 
what you want to do.



That said, you are on the right track concerning setting a cookie.



I don’t know this answer without doing some development and testing, but I will 
add these 2 thoughts:



1-      You should set the cookie explicitly on the ‘other’ domain. So when 
<@DOMAIN> = mydomain.com, set the cookie domain to ‘www.mydomain.com’ and vice 
versa. Let the current domain cookie be handled automatically by TeraScript.

2-      You should set the expiry explicitly. Probably for a few hours from 
now. You can also update the cookie expiry on each request. This should 
basically equal your variabletimeout.



Basically, Witango/TS will manage the local domain cookie for you. So the only 
thing you need to do is set a new cookie that essentially says “if this user 
goes to the other domain in the next x minutes, pass this cookie to the server”.



I would recommend using the ASSIGN action, and setting the Tango_UserReference 
variable in the cookie scope. And then either not setting the httpheader – or 
setting it, but include @SETCOOKIES.



It’s possible that setting this cookie will interfere with TS setting of the 
cookie – again I’d have to test – if so, then you may need to set both the 
current and other domains cookies at the same time. I concede that to do this I 
believe you would have to hand type the cookie syntax as you have below since 
you wouldn’t be able to set the Tango_UserReference variable twice.



Robert



From: WebDude [mailto:[email protected]]
Sent: Friday, October 12, 2012 1:38 PM
To: [email protected]
Subject: RE: TeraScript-Talk: USERREFERENCE



The problem is that I don't want to force users to use one or the other (www or 
non www). I would like the same userreference for each. I am trying to work 
with the header info. I got something to work, but with mixed results depending 
on the browser being used (no line breaks)...



<@ASSIGN local$httpHeader VALUE="HTTP/1.1 200 
OK<@CRLF>Content-Type:text/html<@CRLF>Cache-Control: no-cache, max-age=0, 
must-revalidate, proxy-revalidate<@CRLF>Pragma: no-cache<@CRLF>Set-Cookie: 
Tango_UserReference=<@USERREFERENCE>; path=\; 
domain=.mytargetpackaging.com;<@CRLF><@CRLF>">



Any ideas other ideas?



Thanks for the response!







  _____

From: Bill Downall [mailto:[email protected]]
Sent: Friday, October 12, 2012 9:55 AM
To: [email protected]
Subject: Re: TeraScript-Talk: USERREFERENCE



On Fri, Oct 12, 2012 at 10:34 AM, WebDude <[email protected]> wrote:



Okay... for a need that will take way to long to explain, is there a way to set 
the userreference the same for both WWW and non WWW users upon the first hit on 
a taf file? I am trying some funky stuff like loading an iframe with 2 calls to 
the domain, one with and one without the wwww... no joy. Any help would be 
appreciated.



Any ideas?



I haven't tested, but something like this in your header?



<@if "NOT '<@appfilepath>' contains 'www.'">

<META HTTP-EQUIV="REFRESH" CONTENT="0; URL=http://www.<@cgiparam 
server_name>/<@cgiparam script_name>"">

</@if>



  _____

To unsubscribe from this list, please send an email to [email protected] 
with "unsubscribe terascript-talk" in the body.



  _____

To unsubscribe from this list, please send an email to [email protected] 
with "unsubscribe terascript-talk" in the body.



  _____

To unsubscribe from this list, please send an email to [email protected] 
with "unsubscribe terascript-talk" in the body.



  _____

To unsubscribe from this list, please send an email to [email protected] 
with "unsubscribe terascript-talk" in the body.



  _____

To unsubscribe from this list, please send an email to [email protected] 
with "unsubscribe terascript-talk" in the body.



  _____

To unsubscribe from this list, please send an email to [email protected] 
with "unsubscribe terascript-talk" in the body.



  _____

To unsubscribe from this list, please send an email to [email protected] 
with "unsubscribe terascript-talk" in the body.



  _____

To unsubscribe from this list, please send an email to [email protected] 
with "unsubscribe terascript-talk" in the body.



  _____

To unsubscribe from this list, please send an email to [email protected] 
with "unsubscribe terascript-talk" in the body.




----------------------------------------

To unsubscribe from this list, please send an email to [email protected] 
with "unsubscribe terascript-talk" in the body.

Reply via email to