Tech n mad stuff for mads like me ;) Here i will share tech problems i came across and how i solved em !

About Me

My photo
Think a lot but do less.Life full of downs and less ups but ups are stronger than downs.

Wednesday, September 2, 2009

Migrating your Flash/Flex Application From local/http server to https server

While working with a medical application I faced a lot of annoying situations. But somehow I managed to survive and completed the assigned work with good impression and lots of career defining lessons and this Https issue is one of them.

Its like this
We completed a flex application with alpha testing in a remote server using IP Adress. It was working well and our QA team gave it a green light. But suddenly client wanted to make it secure as they were planning to make a beta release of the application.

They set up a https server and when we uploaded the application it shown us an error like
"This page contains both secure and ..." Well our application is ofcourse not a spam !! and we dont distribute viruses or malwares through our page !!!

After a little google we found out its because of any http link in the application.
So we checked all the http requests and changed them to relative path i.e. placed the backend pages in child directory so that all the requests would automatically be https.
but still same dialogue!!

Then we thought there might be some server setting issue, so we kept running the application pressing "ok" button. and it worked as it was in https in firefox browser but IE started showing its color !! It simply blocked our application in the client end!!
It blocked all http requests giving us hundreds of runtime error by flash player debugger!!
So we got another more issue !!

After a long google with complete frustration i found a lifesaving post which discussed briefly about that bug in IE(even in the latest version 8).
IE says its a security feature but its actually a bug .. he he

What I simply understood is : ie keeps a quick cache whatever the server page header may be(no-cache or blank). And in https secure connections caching is like banned ! so requests with no cache header are kept in cache braking security code and blocking all such server requests with no-cache header(which is deafult).

So they suggested to use a Pragma header as blank .
php code:
header("Pragma: ");


So we included this code to all the requests and we solved the IE bug !
Now pressing "ok" in IE works well and accept result of all the requests.

But What to do with secure non-secure dialogue ??
And I found it !
I checked the html page in which the flex app was embeded got some http links
we didn't checked it as the page was auto generated by Flex Builder 3

The interesting thing in the auto generated page was this :

!--
Smart developers always View Source.

This application was built using Adobe Flex, an open source framework
for building rich Internet applications that get delivered via the
Flash Player or to desktops via Adobe AIR.

Learn more about Flex at http://flex.org
// --



hmm.. smart generators !! :)
but am i ?

So we removed all http reference in the source page but still the dialougs !! :(
I also removed ExpressInstall feature from the page but still same...

Then what i did is ran the swf directly in the browser and it worked with no error !!
so I got confident !!
Then i straight used swfObject and error gone !!
So I solved both the issues
But I am still not sure why swfobject worked ?



No comments: