I have following configuration in Tomcat. I get 403 error when making POST requests from my local machine browser to remote server. I use EASYUI JQuery components, and they work fine on IE10+ and Firefox! Only chrome is complaining this. Can any one hep?
<filter>
<filter-name>CorsFilter</filter-name>
<filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>CorsFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Had the same problem when sending a JSON object via POST, and solved by explicitly setting a JSON content type header:
var config = { headers: {
'Content-Type': 'application/json'
}
};
$http.post(url, config)
.success
...
It seems Chrome is unable to automatically detect the Content Type as well as Firefox etc. can.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With