All, I am trying to get CORS enabled on Tomcat 7.0.52 for Geoserver.
I modified web.xml in conf in tomcat, as specified in http://tomcat.apache.org/tomcat-7.0-doc/co
In my case I was using kartoza/geoserver docker image and I had to download the GeoServer war file from the GeoServer website (for the version used in the docker image) and added the geoserver.war file to the directory /usr/local/tomcat/webapps/ and restarted tomcat.
Only with this configuration above, I managed to enable CORS. Only adding the corsFilter code to web.xml and restarting tomcat, it was resulting in a 404 error when accessing GeoServer. So after adding the war file, the corsFilter code is recognised and it works well.
I hope this helps someone with a similar error.