google app engine - How do I preserve uri fragment in safari upon redirect? -
my gwt / gae application utilizes activities , places. in order create asynchronous processes (such resetting password or verifying ownership of email address) use pattern activity's state can tokenized , stored in datastore, retrieved , resumed later. in order retrieve state token have place takes augmented token id argument, fetches datastore, navigates appropriate place necessary resume process. enables me create link specific state of application can distributed via email. example:
http://mydomain.com/#signup:anjlbmzyb0bldghvc2vkz2uuy29tfdeznzqxotixnju3njq=
in case, above link sent email addres used during signup , application resume signup activity identified hash argument.
everything has been working until when added ssl cert , enforced https requests adding following code web.xml:
<security-constraint> <web-resource-collection> <url-pattern>/*</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>confidential</transport-guarantee> </user-data-constraint> </security-constraint>
this constraint enforces https via (i believe) 301 redirect port 443. works charm in chrome, firefox , ie.... safari seems drop url fragment upon redirect... think can see problem! how prevent safari dropping url fragment?!
update 8.1.13
after exhausting research, think have identified root cause, have yet find solution. thorough description of problem provided in w3c memo handling of fragment identifiers in redirected urls (1999)
basically, http spec unclear handling of url fragments during 3xx redirects; , safari chose drop fragment when redirected. see following bugzilla bug:
https://bugs.webkit.org/show_bug.cgi?id=24175
the desired behavior described w3c's commun user agent problems:
http://www.w3.org/tr/cuap#uri
so in light of this, believe safari (webkit) issue. don't understand why aren't other webkit browsers affected? there known workaround?
just serve redirect page (200) refreshes window.location upon load , injects hash fragment.
<!doctype html> <meta charset="utf-8"> <html> <body> <script> var hash = (location.href.split("#")[1] || null); var pathfield = "{{redirecturi}}"; if (hash) { if (pathfield.indexof("#") == -1) { pathfield = pathfield + "#" + hash; } } window.location = pathfield; </script> </body> </html>
that way, works every browser (at least browsers support javascript). {{redirecturi}} url want redirect to. if contains fragment already, won't overwritten.
Comments
Post a Comment