Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the solution to the sandbox problem of Flex cross-domain access?

Shulou Source: shulou.com Published: 2022-06-02 07:32:01 09月15日 Update

What is the solution to the sandbox problem of Flex cross-domain access? many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can get something.

When Flex accesses the WebService service, it can be accessed normally locally. When it is deployed to a web container and published as a web service, and then WebServicIE is called, access will be denied. This is the sandbox problem of Flex cross-domain access. The solution is described below.

Sandbox problem of Flex Cross-domain access

When Flex accesses the WebService service, it can be accessed normally locally. When it is deployed to a web container and published as a web service, and then WebServicIE is called, access will be denied. This is the sandbox problem of Flex cross-domain access. To solve the problem of Flex cross-domain access to WebService, you can use the following solution:

First of all, Flex cross-domain access is denied because the service provider does not configure a security policy file, that is, crossdomain.xml, if you do not want to use crossdomain.xml, you need to use a proxy, that is, you write a background read webservice, and then provide it to your own flex application, because in flashplayer, Flex cross-domain must have a policy file. Considering that the security has been enhanced after the upgrade of flashplayer to 9.124, the previous crossdomain.xml has been written differently. Here is the complete way to write the file:

Indicates that the service allows access from any external domain.

With regard to the placement directory of crossdomain.xml, there are the following solutions, which can be placed in:

1) if this directory is the root of the container, you can access crossdomain.xml through the following url:

Http://localhost:8080/crossdomain.xml .

2) if crossdomain.xml is not placed in the root directory, but under a certain webapp, it needs to be applied at initialization time in flex.

Security.loadPolicyFile ("http://localhost:8080/xx/crossdomain.xml");"

Where xx is the name of webapp

In this way, when an external Flex accesses the WebService published by the service across domains, the flashplayer first looks for the crossdomain.xml file. If the security mechanism is set to allow access, the access is successful.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Tags: Services problems solutions sandboxes that is files solutions security containers writing root directories directories policies help applications clarity success content can be passed Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology MariaDB Shulou Tech Info macOS Linux