Appreciate any help.

I'm facing the problem with the CORS on my newly deployed Tomcat 8.0.30. I keep getting the error below. I am using 127.0.0.1 as the API server address and 192.168.1.100 is the address of my HTTP server.

> 
> No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '\_http://192.168.1.100:8999' is therefore not allowed access. The response had HTTP status code 403.
> 
> 
> 

Read through whole Tomcat documentation, added the cors filter under the tomcat web.xml, as well as the project web.xml, but nothing magic happens here, still getting the same error. Tried both minimal and advanced with init-param, same error.

I am using Spring 4 as my rest api framework. Any more configurations need to be done on the project coding part?

Here are the steps I've done so far:

* add cors filter under web.xml, mininal config according to documentation, not working
* add cors filter under web.xml, full config, not working as well.
* tried to use cors filter from <http://software.dzhuvinov.com/cors-filter.html>, still not working

Any suggestions?

[![network response](https://i.stack.imgur.com/2JEj2.png)](https://i.stack.imgur.com/2JEj2.png)

---

Add the web.xml configuration
I've tried to change cors.allowed.origins to \*, to 127.0.0.1,192.168.1.100, all not working,
remove credentials and maxage

```
<filter>
  <filter-name>CorsFilter</filter-name>
  <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
  <init-param>
    <param-name>cors.allowed.origins</param-name>
    <param-value>http://192.168.1.100</param-value>
  </init-param>
  <init-param>
    <param-name>cors.allowed.methods</param-name>
    <param-value>GET,POST,HEAD,OPTIONS,PUT</param-value>
  </init-param>
  <init-param>
    <param-name>cors.allowed.headers</param-name>
    <param-value>Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers,Authorization</param-value>
  </init-param>
  <init-param>
    <param-name>cors.exposed.headers</param-name>
    <param-value>Access-Control-Allow-Origin,Access-Control-Allow-Credentials</param-value>
  </init-param>
</filter>
<filter-mapping>
  <filter-name>CorsFilter</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>

```

---

Suggested by Vishal, changing tomcat version from 8.0 to 8.5, still same issue

```
 XMLHttpRequest cannot load http://127.0.0.1:8080/leyutech-framework-gurunwanfeng/api/ad/getAdInfoByAdType.html?adType=0. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://192.168.1.100:8080' is therefore not allowed access. The response had HTTP status code 403.

```