RSS
 

403 Forbidden Error with Adobe AIR app.

13 Feb

Here’s another issue I recently ran across. I was porting an existing (working) Flex 3 project to AIR. Under AIR my RPC calls (via AMFPHP) stopped working, and would return a 403 Permission denied error.

Using ethereal verified the 403 error. The were minor differences in the headers sent when executing the NetConnection.call() from Flex and AIR. One of those differences happened to be the “user-agent.” My gateway is hosted on a shared webhost, so this was my first guess as to what might be the problem.

I launched charles, and sure enough, the server would reject (via 403) any POSTs made with a user-agent of “Shockwave Flash.” Changing the user-agent (via charles) to pretty much anything else fixed the problem.

I contacted both Adobe and my webhost. The Adobe engineers stated the default user-agent has been changed for the final release of air. My webhost was gracious enough the give me a line to add to my .htacess to revoke this “filter”

Everything is now working.

 
3 Comments

Posted in AIR, AMFPHP

 
  1. Ed Rowe

    February 14, 2008 at 4:42 am

    You can also change the user-agent for your AIR app by setting URLRequestDefaults.userAgent or on a per-request basis via URLRequest.userAgent

    Ed Rowe
    Adobe AIR Team

     
  2. admin

    February 14, 2008 at 11:24 am

    Ed thanks for the feedback. If I’m not mistaken, the URLRequestDefaults.userAgent will not change the user-agent sent by NetConnection calls. It does change the user-agent for the URLRequests however. Here’s a link to my discussion on the Adobe forums http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=641&threadid=1334561

     
  3. Serg

    February 21, 2008 at 3:00 pm

    Hi, I experience same problem, could you please email me that line from your .htacess to revoke this “filter”, because my support responds very slow

    Thanks.