Custom header param – Spring Boot

Problem solved.

I have a CORS Filter in my application. I had to add my custom header param to the


list to allow it. After that, the endpoint was consumed and worked as expected.

This is how my Filter is now:

public class SimpleCORSFilter implements Filter {

    private final Log logger = LogFactory.getLog(this.getClass());

    public void init(FilterConfig fc) throws ServletException {"SimpleCORSFilter loaded");

    public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException {
        HttpServletResponse response = (HttpServletResponse) resp;
        HttpServletRequest request = (HttpServletRequest) req;
        response.setHeader("Access-Control-Allow-Origin", "*");
        response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE, PUT");
        response.setHeader("Access-Control-Max-Age", "3600");
                "x-requested-with, authorization, Content-Type, " +
                "Authorization, credential, X-XSRF-TOKEN, idEmpresa");

        if ("OPTIONS".equalsIgnoreCase(request.getMethod())) {
        } else {
            chain.doFilter(req, resp);


    public void destroy() {

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top