javascript - Origin 'http://localhost:8888' is not allowed access with Gulp, Restangular, Java EE and Wildfly 8 -
the restangular works fine post() or get(), if want delete something, got following error:
no 'access-control-allow-origin' header present on requested resource. origin 'http://localhost:8888' therefore not allowed access.
i tried solution on site:
how enable cross domain requests on jax-rs web services?
@provider public class corsfilter implements containerresponsefilter { @override public void filter(final containerrequestcontext requestcontext, final containerresponsecontext cres) throws ioexception { cres.getheaders().add("access-control-allow-origin", "*"); cres.getheaders().add("access-control-allow-headers", "origin, content-type, accept, authorization"); cres.getheaders().add("access-control-allow-credentials", "true"); cres.getheaders().add("access-control-allow-methods", "get, post, put, delete, options, head"); cres.getheaders().add("access-control-max-age", "1209600"); } } but got following error:
the 'access-control-allow-origin' header contains multiple values 'http://localhost:8888, *', 1 allowed. origin 'http://localhost:8888' therefore not allowed access.
i don't quite understand error mean , how fix it? thanks!
the localhost:8888 defined in gulp.
the 'access-control-allow-origin' header must 'http://localhost:8888'
it explained in second answer in thread:
why jquery's .ajax() method not sending session cookie?
Comments
Post a Comment