corsflumeflume-ng

Enabling cross-origin resource sharing on Apache Flume


I am developing a web-page that basically connects to the Flume server through port 8080. Every time that the client sends a new petition, it throws 403 Forbidden error, because the HTTP source does not know how to handle OPTIONS requests.

There is no specific mention in the documentation of Apache Flume on how to enable CORS.


Solution

  • It turns out I had to modify Flume's source code.

    In the file HTTPSource (private class FlumeHTTPServlet), add the following method:

    @Override
    public void doOptions(HttpServletRequest request, HttpServletResponse response)
    throws IOException
    {
        response.addHeader("Access-Control-Allow-Origin", "*");
    }