- Print
- DarkLight
Rest Service Trouble Shooter
This page have information about problems with Rest-services.
CORS Policy
Problem
A Rest Service in Comflow, worked in Postman and executed correctly, but in a web browser returns and error about CORS:
“Access to XMLHttpRequest at 'http://localhost:9090/comflow/rs/authentication/authenticate' from origin 'http://localhost:8080' has been blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response”
Solution
Edit web.xml to remove x-frame-option. - However, you may put the application at risk for click jacking!
<filter>
<filter-name>httpHeaderSecurity</filter-name>
<filter-class>org.apache.catalina.filters.HttpHeaderSecurityFilter</filter-class>
<init-param>
<param-name>antiClickJackingEnabled</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>antiClickJackingOption</param-name>
<param-value>SAMEORIGIN</param-value>
</init-param>
</filter>