I try to use a WFS service with OpenStreetMap to request GeoServer GeoJSON file. First I had a error message on the Firefox
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:8080/geoserver/robot/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=robot:geofield&outputFormat=aoolication%2Fjson. (Reason: CORS header 'Access-Control-Allow-Origin' missing).
Then I pasted the following lines in the web.xml from /usr/share/geoserver/webapps/geoserver/WEB-INF
<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>*</param-value> </init-param> </filter> <filter-mapping> <filter-name>CorsFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
After when I go on http://localhost:8080/geoserver/ I have a HTTP ERROR: 503 and still have the same CORS header problem
I don't know what is wrong, maybe this method doesn't work with latest GeoServer versions
If someone has a good and clear answer, it will be great because I think I'm not the only one who want to use a wfs with GeoServer and OpenLayers.