I am trying to configure CORS support in grails and I am using the following filter:
class CorsFilters {
def filters = {
all(controller:'*', action:'*') {
before = {
response.setHeader("Access-Control-Allow-Origin", "*")
}
}
}
}
From testing, it seems that the response header is correctly configured for all requests, but when I make a request from the outside against the local host or any server accessible to me, I get the following error:
XMLHttpRequest cannot load http://server:8080. Origin http://jsbin.com is not allowed by Access-Control-Allow-Origin.
This live example works on my Chrome instance, so I don’t know what could happen here. In unsuccessful requests, I try to push tomcat directly.
What can happen to prevent this from happening?
source
share