问题
we have two webserver and we have dedicated the task between these two servers. we've decided to put all the asp/aspx page into one server and put an upload.aspx + sql server into another one:
and here is name of the servers :
http://server1.somecompany.com // this is where all the pages reside + swfupload
http://server2.somecompany.com // this is where upload.aspx and sql server resides
and here is the code inside add_item.asp where swfupload gonna call upload.aspx from server2
SWFUpload.onload = function () {
var audio_settings = {
flash_url : "../script/swfupload.swf",
upload_url: "http://server2.somecompany.com/upload.aspx", // this is where swfupload from server1 call server 2
post_params: {
"ASPSESSID" : "{CDDAF2E2-1178-4465-9842-E54751DE8664}",
"HELLO-WORLD" : "Here I Am",
"section" : "sound"
},
when I click upload button swfupload tries to redirect my page to server2.somecompany.com and doesn't do its job properly
but when I change the upload_url : to someting like :
http://server1.somecomapny.com
everything works fine
I know it is something about security issue in swfupload and they have solved it like this but this fixation makes us dazed .
what can I do about it?
regards.
回答1:
This is a security measure in Flash. You can configure your remote server to accept these requests, however, by including a file called crossdomain.xml
in your server's HTML root.
The file should look something like this:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="[ YOUR SOURCE DOMAIN HERE ]" to-ports="80" />
</cross-domain-policy>
If you must allow access from everywhere, replace "[ YOUR SOURCE DOMAIN HERE ]" with an asterisk "*".
For more information, read here: www.adobe.com/devnet/flashplayer/articles/cross_domain_policy.html
Good luck!
来源:https://stackoverflow.com/questions/3667687/swfupload-wont-allow-me-to-upload-from-a-server-to-another-one