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

Jetty version?

Jan

On 6 March 2015 at 14:10, 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.
>
> Can someone suggest the reason or how to fix this? Can the original web.xml
> interfere with the overrideDescriptor?
>
> Any help is appreciated.
>
> Thanks,
>
> Harsh
>
>
>
> _______________________________________________
> jetty-users mailing list
> jetty-users@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from
> this list, visit
> https://dev.eclipse.org/mailman/listinfo/jetty-users



-- 
Jan Bartel <janb@xxxxxxxxxxx>
www.webtide.com
'Expert Jetty/CometD developer,production,operations advice'


Back to the top