my silverlight site is running in https port, when i try to access some handler in my site it searches for crossdomain.xml and clientaccesspoliy.xaml
the problem is it always searches crossdomain in https://ipaddress//crossdomaim.xml
so when i debug with fiddler it shows HTTP Error 404.0 - Not Found.
client accesspolicy.xml
<?xml version="1.0" encoding="utf-8" ?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
crossdomain.xml
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-http-request-headers-from domain="*" headers="SOAPAction,Content-Type"/>
</cross-domain-policy>
First, get rid of the crossdomain.xml file as you only need clientaccesspolicy.xml for Silverlight (and it has more features).
Second, the file must be in the root of the https site, as that is not the same as the http site (I assume you have placed the file on your http site only). You need in on both sites if both the http and https sites are accessed by your app.
Thirdly, if you are still having problems, add https explicitly to the config. e.g. with
<allow-from>
<domain uri="http://*">
<domain uri="https://*">
</allow-from>)
This page on Network Security Access Restrictions in Silverlight has more detail of the options
Try This crossdomain.xml
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM
"http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<!--<allow-http-request-headers-from domain="*" headers="SOAPAction,Content- Type"/>-->
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>
Related
i am a complete beginner in java world, i want to start building an JAX-RS endpoint so i am using Intellij with glassfish/tomcat application servers.
after i run my server, i tried all the urls like
http://localhost:8080/Demo-1.0-SNAPSHOT/api/hello-world
http://localhost:8080/Demo-1.0-SNAPSHOT/hello-world
and it didn't work.also i tried with tomcat, same problem. it would be nice if someone help me unblock this problem.
here is my project and its configuration :
https://i.imgur.com/oG0TqXG.png
https://i.imgur.com/qiOOunQ.png
I think you need a web.xml under src/main/webapp:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
<session-config>
<session-timeout>
15
</session-timeout>
</session-config>
</web-app>
And you can put the beans.xml in the same Folder.
I'm running Tomcat 8.0.21 with java 1.8.0_40
I'm trying to create a costum error page, which should be displayed when I redeploy my application and the servlet is not reachable.
The obvious solution adding:
<error-page>
<error-code>404</error-code>
<location>/ErrorHandler/404.html</location>
</error-page>
to the <tomcatDir>/conf/web.xml won't work here since tomcat always seems to look for the error page in the same servlet. (so e.g. if calling <url>/idonotexist he uses the 404.html located in ROOT/ErrorHandler/404.html and not in ErrorHandler/404.html as I would have expected) If the webapp is down (stopped via the manager app, or due to maintenance) the error page is blank.
If I remove the lines from the <tomcatDir>/conf/web.xml the default tomcat 404 error message is shown though. Is there any possibility to change the default error handling of tomcat?
edit:
ErrorHandler is a deployed webapp with the following web.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<display-name>Error Application</display-name>
<description>
A webapp for error handling
</description>
<!-- servlet definition -->
<servlet>
<servlet-name>ErrorHandler</servlet-name>
<servlet-class>ErrorHandler</servlet-class>
</servlet>
<!-- servlet mappings -->
<servlet-mapping>
<servlet-name>ErrorHandler</servlet-name>
<url-pattern>/ErrorHandler</url-pattern>
</servlet-mapping>
</web-app>
If I call <tomcatUrl>/ErrorHandler/404.html in my browser I can view the error page just fine.
I'm having a really strange problem (at least it is strange because it has worked for me in the past) with a Silverlight Application consuming WCF services.
When I debug both Silverlight Application and WCF in localhost it works perfect. When I publish both projects, they work perfect. The problem is when I try to debug the Silverlight Application against published WCF... it throws the typical crossdomain exception.
I promise I've both clientaccesspolicy.xml and crossdomain.xml uploaded into the root path in server.
Looking in fiddler, it doesn't even try to read the clientaccesspolicy file before crashing.
Do you have any idea??? Thanks in advance.
Put these files inside your service folder
clientaccesspolicy.xml
<?xml version="1.0" encoding="utf-8" ?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="*"/>
</allow-from>
<grant-to>
<resource include-subpaths="true" path="/"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
crossdomain.xml
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>
I have a Silverlight app hosted on server A, and a WCF service hosted on server B on IIS 6. Server B disallows any non-https connections (not that it doesn't rewrite them.. they just fail).
in wwwroot for server B I have a clientaccesspolicy.xml file
<?xml version="1.0" encoding="utf-8"?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
Looking at proxy traffic, I can now see the silverlight app requesting mydomain/clientaccesspolicy.xml and returning an HTTP 200 with the contents, however, silverlight then gives a security exception.
I have tried many variations of the clientaccesspolicy.xml files and even crossdomain.xml examples floating around the internet to no avail.
Additionally, the SL app works if I install it instead of run it through the browser.
I am wondering if this is a SL 5 bug?
Note that this is a follow-up to my original question I asked earlier, where I was unable to see the clientaccesspolicy.xml request go out (but I can now and it still doesn't work).
I have created a wcf service that i have uploaded to my host (using IIS). Everything works fine.
So, if i go to http://www.mydomain.com/path/Service.svc it works fine.
If i go to http://mydomain.com/path/Service.svc i get a resource not found error.
I have created a clientaccesspolicy.xml under the path folder which contains the following:
<?xml version="1.0" encoding="utf-8" ?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="SOAPAction">
<domain uri="http://*"/>
<domain uri="http://www.mydomain.com/path/*" />
<domain uri="http://mydomain.com/path/*" />
</allow-from>
<grant-to>
<resource include-subpaths="true" path="/"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
but it doesnt seem to have any effect. Have looked on the web but didnt find a decent explanation on how this is solved. Any ideas?
Thank you.
You should to add more host headers on IIS. Take a look here: How to Create Multiple Websites with one IP address