Flash in iframe got 403 forbidden with NW.js

I have an nw.js app where I use a tag iframe

to load an external page using a flash object. All traffic for the application goes through the TCP proxy that I wrote. I haven't changed any of the data, just monitoring.

var gui = require('nw.gui')
// set proxy to my tcp proxy server
gui.App.setProxyConfig('localhost:5050')

      

The problem is that when the .swf

game file is requested, it returns an error 403 Forbidden

and the game won't load.

The proxy works well, when I use it with Chrome I can load the game page. And in the app, if I don't set the proxy, the game loads fine.

I compared HTTP request for file .swf

from Chrome vs nw.js, they have some differences in HTTP headers.

In Chrome

GET http://foo.bar/sth.swf HTTP/1.1
Host: foo.bar
Proxy-Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36
X-Requested-With: ShockwaveFlash/17.0.0.134
Accept: */*
Referer: STH_VERY_LONG
Accept-Encoding: gzip, deflate, sdch
Accept-Language: zh-CN,zh;q=0.8,en;q=0.6

      

In nw.js

GET http://foo.bar/sth.swf HTTP/1.1
Host: foo.bar
Proxy-Connection: keep-alive
Referer: STH_VERY_LONG
User-Agent: 
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,en-us;q=0.8,en;q=0.6

      

difference

Nw.js is missing headers Accept

and X-Requested-With

and the header is User-Agent

empty. Other titles are the same.

I tried adding an attribute nwUserAgent

to the tag iframe

as described here , but the title User-Agent

remains empty.

So, I want to know:

  • why are 2 titles missing
  • How can I get the app and proxy to work together.

thank.

UPDATE

The problem was pointed to the title User-Agent

. see this question

+3


source to share





All Articles