2 Replies Latest reply on Sep 1, 2009 3:27 AM by Quentin T

    AIR Badge + RewriteRule fails - Downloaded file is not an air file

    Quentin T

      Hi everyone!

      I'm not entirely sure my problem comes from RewriteRule but I've searched this forum for topics on corrupted AIR files and the Install Badge and tried almost every possible tip with no luck so I thought maybe my special issue comes from it...

       

      Here we go:

      I have a server-side script that builds AIR apps which are supposed to be installed (via an Install Badge). Those AIR apps are not stored at a public URL (for security reasons) but read (via PHP) when a specific URL is called. Let me give you an example (with fake paths) :

       

      The server-side built AIR app is store at /srv/data/air/myApp.air

      A RewriteRule redirects calls to http://www.my-server.com/air/999.air to http://www.my-server.com/air.php?id=999

      The air.php uses the GET id to read the AIR file :

       

      header("Pragma: public");

      header("Expires: 0");

      header("Cache-Control: must-revalidate, post-check=0, pre-check=0");

      header("Cache-Control: private", false);

      header("Content-Type: $mimeType");

      header("Content-Disposition: attachment; filename=$name;" );

      header("Content-Length: ".filesize($path));

      readfile($path);

       

      With $mimeType="application/vnd.adobe.air-application-installer-package+zip" and $name="999.air"...

       

      When accessing the rewritten URL directly with a browser, everything is fine: the AIR file can be downloaded and installed as expected.

      But! When using an Install Badge linking to that URL, I get the nasty "The application could not be installed because the AIR file is damaged" message...

       

      And here's what's stored in .airappinstall.log:

       

      Starting app install of http://(...)/9889.air

      UI SWF load is complete

      UI initialized

      Downloading file to C:\Documents and Settings\Quentin\Local Settings\Temp\fla19D.tmp

      Received HTTP Response Status event

      Response URL is http://(...)/9889.air

      Downloaded file is not an air file.

      starting cleanup of temporary files

      application installer exiting

      Hum... And I'm stuck.
      Thoughts?
      I have multiple Install Badges in the same page, do you think this can break things?
      I've try adding the AddType instruction in a .htaccess file but it didn't change a thing...
      Thanks in advance!