• Is it possible to somehow set response headers?

    By Robert Ibsen Voith 3 years ago

    I was fiddling around with SmartNSF and soon realized that I needed the CORS-header to make it somewhat easier to debug. In other words, setting the 'Access-Control-Allow-Origin' to '*' or 'true'. I suspect that I probably can use the event PRE_LOAD_DOCUMENT to do stuff like this, but I am not sure. Any tips?

    • By Christian Güdemann 3 years ago

      I would do it during the PRE_SUBMIT event:

      events PRE_SUBMIT:{

        context, document ->
        def response = context.getResponse();
        response.addHeader....
      

      }

      context.getResponse() returns a HttpServletResponse