We have a Flash application that connects to a WCF REST web service returning json data.
We use URLRequest/URLLoader with POST requests, not a lower-level library using sockets like as3httpclientlib.
The application runs swimmingly well in the normal course of duties, but when we are behind a corporate proxy server (ie. In Internet Explorer Conenction tab a proxy is defined) some requests are returning HTTP status code 502 - DNS Lookup Failed. (We use Fiddler to inspect the traffic). The connection works fine for the first few requests but then seems to die - with these 502 errors.
What could be causing this?
I have heard that using low-level socket programming can cause problems with proxy servers in corporate environments - but that's not what we are using here.
EDIT:
Upon further investigation (using fiddler) this is what is happening:
- The first POST request is made.
- Proxy returns a 407 (cache request denied - unauthenticated to proxy)
- Request is made again with a proxy authorization header
- Proxy returns a 407 with some sort of return proxy-authenticate header.
- Original request is made once more - this time with proxy-authentication but my authorization header ("authorization: username:password") has been stripped by the proxy and thus the request fails.
Not sure how to get around this...
EDIT:
I added my authorization header using URLRequest in actionscript. The proxy server was using NTLM authentication. The authorization header I added was removed in Step 2.
I found that if I used a header with a random name like 'Security' instead of 'Authorization' then the header was not stripped out.