javascript - Cross-origin resource sharing for Tomcat 5.5 -
i new cross-origin resource sharing , want enable in tomcat 5.5 server. can give me hint how can achieved?
i want set header universally requests, , allow origins (access-control-allow-origin: *
)
if it's static site, starting tomcat 7.0.41, can control cors behavior via built-in filter.
pretty thing have edit global web.xml
in catalina_home/conf
, add filter definition:
<!-- ================== built in filter definitions ===================== --> ... <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> <!-- ==================== built in filter mappings ====================== -->
be aware, though, firefox not access-control-allow-origin: *
, requests credentials (cookies): when responding credentialed request, server must specify domain, , cannot use wild carding.
Comments
Post a Comment