How to solve problem with embed AppStream in recent Chrome update

AppStream from Amazon is service that allows to have Remote Desktop Session in your browser. Our company is using it to do evaluation of our software for potential customers. Customers can play with, explore it features etc, before buy. On other side, we can see what people are struggling it and adjust our software.

We were using it for some time, but recent Chrome update broke it. Safari stopped working some time before that. Now instead of opening remote session, we got 404 from Amazon. I believe it happens because Chrome stopped providing cooking for embedded iframe. And following post will show, how to fix it.

Normally service works like this. Web page calls some service on backend to get streaming url. Then following code will embed AppStream session on your page:

  var appstreamOptions = {
    sessionURL: url,
    userInterfaceConfig: {[AppStream.Embed.Options.HIDDEN_ELEMENTS]: []}

  appstreamEmbed = new AppStream.Embed('embed-app-stream-container', appstreamOptions);

But because stream URL is actually Amazon URL, all cookies will not apply and as result session will fail to load with 404 errors.

To fix it Amazon suggests to create sub-domain:  And here I will show how to do it and how to test it.

Let’s assume you have this site: We have to create that will forward all requests to appropriate Amazon services. In this example I will use ap-northeast-1 region. I will show to create test environment on your PC. For live web site it is better to contact your IT, but principle is exactly the same.

Ok, first thing I did is to create following entry in C:\Windows\System32\drivers\etc\hosts file and add following line:

From now on, when I will access, it will go to my PC instead of internet. It is obvious step for any web site development.

Next thing, I create new web site in IIS and bind it to You have to bind it only for HTTPS. I did mistake of binding it HTTP and then nothing worked correctly until I tried Firefox that actually let me know that I was accessing HTTPS from HTTP page.

On that site I put one html page from real web site as well as couple of JS scripts that used on that page. You should know what to copy. Open HTTP Response Headers and add item “appstream-custom-url-domain” with value “”. Without quotes obviously. Check that everything except AppStream is working. You will see few requests going to Amazon and finally 404 response.

On next step you should install Application Request Routing Cache for your IIS. After that start IIS Manger, select server node (top node) in left tree and open “Application Request Routing Cache”. On the left side click on “Server Proxy Settings…”. There check “Enable proxy”, uncheck “Reverse rewrite host in response headers” (it does not work properly). I also unchecked “Include TCP port from client IP” and “Enable disk cache”

After that create new web site in IIS and bind it to and to *. Then open URL Rewrite for that site, click Add Rule from the top-left side and select Reverse Proxy. Enter as server name and uncheck “Enable SSL Offloading”.

Basically we have requests that coming towards  in form of  <prefix><suffix> . For example, request:

should be changed to

but then on return all 302 responses should change location back to For example, when Amazon returns

as location, it should be changed to

and browser will query our site instead of Amazons.

To do this open Inbound rule that IIS created and change conditions to this:

And Rewrite URL in “Action Properties” to:

This will allow to change incoming URL, change to appropriate Amazon URL and request it from Amazon. This implements first part.

Next, create new blank Outbond rule. Create one precondition using “Regular Expressions” and add this condition: {RESPONSE_STATUS} Matches the Pattern “3\d\d” without quotes. Then in Match section select “Server Variable”  and in “Variable name” use “RESPONSE_Location” (without quotes).

Then use this as Pattern:

Action type suppose to be rewrite, and “Value” in “Action Properties” should be this:

This will replace location in response from Amazon link to our sub-domain and browser will request next response from us and not from Amazon.

We are almost there. Next I found that first request to Amazon always redirect to subdomain that have many digits and letters. Let’s say it is As result I also added to hosts file. And remember that we added *  to IIS binding. That should cover it.

And last thing to do is to change URL in script file to this:

  var newUrl = url.replace('/', '/');
  var appstreamOptions = {
    sessionURL: newUrl,
    userInterfaceConfig: {[AppStream.Embed.Options.HIDDEN_ELEMENTS]: []}

  appstreamEmbed = new AppStream.Embed('embed-app-stream-container', appstreamOptions);

And now, from browser’s point of view, we are accessing sub-domain, and all cookies and everything will nicely flow from our main site to our sub-domain and AppStream is working correctly.

As I said before, this is setup for local testing. Live site should be setup by professionals.

I hope it helps someone.