Custom headers possible with URLRequest / URLStream using GET?

Pretty simple:

var req:URLRequest=new URLRequest(); req.url="http://somesite.com"; var header:URLRequestHeader=new URLRequestHeader("my-bespoke-header","1"); req.requestHeaders.push(header); req.method=URLRequestMethod.GET; stream.load(req); 

However, if I check traffic using WireShark, my-bespoke-header not sent. If I go to URLRequestMethod.POST and add some data to req.data , then the header will be sent, but the receiving application requires GET, not POST.

The documentation mentions a blacklist of headers that will not be sent. my-bespoke-header not one of them. It might be worth mentioning that the original request is being executed from another port in the same domain. Nothing is reported in the policy log, so this seems unlikely, but can this be fixed by forcing crossdomain.xml to be downloaded using allow-http-request-headers-from , even though this is not a crossdomain problem? Or is it just an undocumented Flash Player feature that it can only send its own headers with a POST request?

+4
source share
2 answers

From what I can compile, it seems that your assumption that there is no support for custom headers for HTTP GET is indeed an undocumented function (or an error?) In standard libraries.

In any case, you may need to make as3httpclient fit your goals and allow you to get around this problem. Here is the corresponding snippet from the post on the developer's blog for this library:

"I was unable to set the HTTP / GET header. Macromedia Flash The player allows you to set only the header for POST requests. I discussed this with Ted Patrick and he told me how I can make Socket to achieve and he was very kind to give me The code fragment that delivered me began. "

+6
source

If this restriction was undocumented at the same time, this is no longer the case. Cm:

http://livedocs.adobe.com/flex/3/langref/flash/net/URLRequest.html#requestHeaders

"[...] Due to browser restrictions, custom HTTP request headers are only supported for POST requests, not GET requests. [...]"

+6
source

All Articles