Introduction
clientaccesspolicy.xml is the file a service puts at the root of its domain so that Microsoft Silverlight applications hosted on other domains may call it. The Microsoft page read for this site
(“How to: Use cross-domain policy files”, last updated 2010-04-12) says to “place a clientaccesspolicy.xml file at the root of the domain where the service is hosted”: for a service on
https://fabrikam.com the file is https://fabrikam.com/clientaccesspolicy.xml. The same page offers an alternative, a valid crossdomain.xml that marks the entire domain public:
“Silverlight supports a subset of the crossdomain.xml schema” (see crossdomain.xml).
That page gives examples and a few sentences, not a schema. This site therefore describes only what the examples show; everything else is marked as not covered.
Structure
<?xml version="1.0" encoding="utf-8"?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="SOAPAction">
<domain uri="*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
| Element | What the Microsoft page shows |
|---|---|
access-policy, cross-domain-access, policy | The nesting of every example. |
allow-from | Who may call. Its http-request-headers attribute: * (all headers that have not been blacklisted) or a comma-separated list of allowed headers, where a header may end in a wildcard, as in X-CUSTOM-*. |
domain | Its uri attribute is * (any other domain) or one domain such as https://contoso.com. To allow an HTTPS service to be called from a Silverlight control hosted over HTTP, add <domain uri="http://*"/>. |
grant-to | What is granted. |
resource | path (/ in the example) and include-subpaths (true). |
socket-resource | Enables access over TCP sockets: <socket-resource port="4502" protocol="tcp" /> in grant-to, where 4502 is the port the service is hosted on. |
In the explorer
A file named clientaccesspolicy.xml, or any .xml file whose root element is access-policy, opens here: the XML tree, a Rules tab, and the problems. Because the page shows examples only,
the problems are limited to elements and attribute values that are not in the examples (marked “inferred” where the page states no rule) and to the few forms the page lists: a domain without uri,
a uri that is neither * nor a scheme and host, an include-subpaths that is not true or false, a protocol other than tcp, a header list that is neither * nor a
comma-separated list. Other XML opens as XML. In the public web, of the six addresses that answered at all, two were real policy files; the others were HTML pages.
Not described
Known, not yet covered
- Reference: the full list of elements and attributes, which are required, the values of
protocolother thantcp, port ranges for sockets, the meaning of the blacklisted headers, and how Silverlight tells this file from a crossdomain.xml: the page read does not say, and a schema reference was not found in the sources read. - Viewer: only the shapes of the examples are checked; the rules marked “inferred” in the problem texts are guesses from the examples, not statements of the page.
Unknown
- Reference: any Microsoft schema or specification beyond the one page: none was found.
- Reference: which clients besides Silverlight read the file: no source read.
Links
Reference
- How to: Use cross-domain policy files – Microsoft’s Silverlight documentation (archived)
- crossdomain.xml – Adobe’s format, of which Silverlight supports a subset