Forum Discussion

Mike_Wethington's avatar
Mike_Wethington
Icon for Nimbostratus rankNimbostratus
Mar 20, 2014

Redirect and insert a cookie that will survive the 302 to 200.

I am redirecting requests from our desktop to mobile site. We need to track when this is done so i am inserting a cookie on the original request and the cookie is being set but on the 302 redirect the cookie does not appear code is below, how can i set a cookie on the original request and have the cookie passed to the redirect? ..... } elseif {[class match [string tolower [HTTP::header "User-Agent"]] contains mobileagent] and [string tolower [HTTP::path]] equals "/"}{ Redirect the request HTTP::respond 302 Location "http://mstage.mydomain.com" Set-Cookie "redir=www" ...... The initial request with a 302:

 

Accepttext/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8 Accept-Encodinggzip, deflate Accept-Languageen-US,en;q=0.5 Connectionkeep-alive Cookieredir=www; my.omniture=Mobile|Sefa8e985a3717903; mbox=session1395334620663-7001591395337771|PC1395334620663-700159.19_211396545511|checktrue1395335971; s_sess=%20s_cc%3Dtrue%3B%20s_sq%3D%3B; s_pers=%20s_nr%3D1395335911051-New%7C1397927911051%3B%20s_lastvisit%3D1395335911051%7C1489943911051%3B%20s_lastvisit_s%3DFirst%2520Visit%7C1395337711051%3B; s_vi=[CS]v1|29958EEE85161A95-600001A2A005C927[CE] Hoststage2.mydomain.com User-AgentMozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16

 

The redirect: Accepttext/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8 Accept-Encodinggzip, deflate Accept-Languageen-US,en;q=0.5 Connectionkeep-alive Cookiemsession=Sefa8e985a3717903; my.omniture=Mobile|Sefa8e985a3717903; mbox=session1395334620663-7001591395337771|PC1395334620663-700159.19_211396545511|checktrue1395335971; __utma=171383996.1649052543.1395334621.1395334621.1395334621.1; __utmb=171383996.16.10.1395334621; __utmc=171383996; __utmz=171383996.1395334621.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); s_sess=%20s_cc%3Dtrue%3B%20s_sq%3D%3B; s_pers=%20s_nr%3D1395335911051-New%7C1397927911051%3B%20s_lastvisit%3D1395335911051%7C1489943911051%3B%20s_lastvisit_s%3DFirst%2520Visit%7C1395337711051%3B; save.complete.show.pwid=; s_vi=[CS]v1|29958EEE85161A95-600001A2A005C927[CE] Hostmstage.mydomian.com User-AgentMozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16