Internal implementation of proxy websites like kproxy -
Internal implementation of proxy websites like kproxy -
i want implement proxy website kproxy.com, can load website in site's iframe , proxy info of website server
i have checked functionality , found out replace script tags, link(css) tags , image tags fetch content server
eg. if original website contains tag like
<script src="http://google.com/abc.js"></script>
they replace
<script src="http://kproxy.com/redirect/foo/bar/abc.js"></script>
i have accomplished kind of functionality replacing nodes can proxied through server
but problem remains ajax calls, originated javascript , phone call original server, in iframe "x-frame-options = sameorigin"
error
so can having same functionality kproxy does? , proxy traffic through server only.
your problem arises links (probably ajax ones) beingness generated towards different domain.
you should check scripts download urls beingness built @ runtime like
...a="https:"==g.location.protocol?"https://csi.gstatic.com/csi":"http://csi.gstatic.com/csi");return...
(example taken google analytics). same goes jquery applets.
also, should verify of scripts don't create ajax calls of own retrieve farther urls. if do, need check whether want proxy calls well.
basically, each phone call gives same-origin failure, need track whence came from, , instruct proxy recognize , rewrite it.
or can seek , same in javascript, i.e., inject javascript code rewrite urls @ runtime. illustration have explicit check for, say, ckeditor
// client requested script , you, proxy, fetched in 'script' if (script contains 'ckedit.options') { determine init phone call position in script split script in two, , b, before , after init phone call create 'script' equal new script made of b plus c plus concatenated c line "ckedit.options.url = 'http://mysite/proxy...';\n" that, user side, initialization happen site's address script propagate address in lots of places without need rewrite else. } else { // script unmodified } ... other checks above... ... finally: send 'script' client
proxy http-proxy proxy-server webproxy
Comments
Post a Comment