Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Jetty context.xml overrideDescriptor not working for CORS

Hi,

On Fri, Mar 6, 2015 at 4:10 AM, Harsh Prasad <prasadtanay@xxxxxxxxxxx> wrote:
> Hi,
>
> I have been trying to enable CORS on a jetty server using overrideDescriptor
> tag in context.xml. The override-web.xml is as follows:
>
> <web-app>
>  <filter>
>
>     <filter-name>cross-origin</filter-name>
>
> <filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>
>     <init-param>
>         <param-name>allowedOrigins</param-name>
>         <param-value>*</param-value>
>     </init-param>
>     <init-param>
>         <param-name>allowedMethods</param-name>
>         <param-value>GET,POST,DELETE,PUT,HEAD</param-value>
>     </init-param>
>     <init-param>
>         <param-name>allowedHeaders</param-name>
>         <param-value>origin, content-type, accept</param-value>
>     </init-param>
> </filter>
> <filter-mapping>
>     <filter-name>cross-origin</filter-name>
>    <url-pattern>/*</url-pattern>
> </filter-mapping>
> </web-app>
>
> I have added the following line in my jetty-context.xml
>
> <Set name="overrideDescriptor">/path/to/override-web.xm</Set>
>
> When Jetty is started i can see in the Debug logs that CrossOriginFilter is
> initialised properly. But i am still getting No
> 'Access-Control-Allow-Origin' header is present on the requested resource. I
> don't know why is this happening.

The COF debug logs should say what's happening to the request and you
should be able to understand why the filter did not apply.

-- 
Simone Bordet
----
http://cometd.org
http://webtide.com
http://intalio.com
Developer advice, training, services and support
from the Jetty & CometD experts.
Intalio, the modern way to build business applications.


Back to the top