Jetty Cross Origin Filter

前端 未结 5 1850
故里飘歌
故里飘歌 2020-12-04 15:36

I\'ve configured Jetty\'s cross origin filter, but I continue to get the following error. Does anyone know what is wrong and how to fix it? Below the error message is my ove

5条回答
  •  萌比男神i
    2020-12-04 16:18

    For me ( jetty-version 8.1.5.v20120716 ) only these lines in 'web.xml' helps:

    
        cross-origin
        org.eclipse.jetty.servlets.CrossOriginFilter
        
            allowedOrigins
            *
        
        
            allowedMethods
            GET,POST,DELETE,PUT,HEAD
        
        
            allowedHeaders
            origin, content-type, accept
        
    
    
        cross-origin
       /*
    
    

    I've change log level to DEBUG and get information (like 'GET,POST,DELETE,PUT,HEAD' and 'origin, content-type, accept') from jetty console log. E.g.:

    DEBUG CrossOriginFilter:359 - Method DELETE is among allowed methods [GET, POST, DELETE, PUT, HEAD] 19:14:28,413

    DEBUG CrossOriginFilter:389 - Headers [origin, content-type, accept] are not among allowed headers [*]

    Then I checked result with $.ajax({url:'anotherHost', type:'DELETE', ..})

提交回复
热议问题