@Override
    public void doFilter(final ServletRequest request,
                         final ServletResponse response,
                         final FilterChain chain)

            throws IOException, ServletException {

        if (!(response instanceof final HttpServletResponse httpServletResponse)) {
            final String message = "Unexpected response type: " + response.getClass().getName();
            LOGGER.error(message);
            return;
        }

        if (!(request instanceof final HttpServletRequest httpServletRequest)) {
            final String message = "Unexpected request type: " + request.getClass().getName();
            LOGGER.error(message);
            httpServletResponse.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, message);
            return;
        }

        filter(httpServletRequest, httpServletResponse, chain);
    }
<p>
Filter to avoid posts to the wrong place (e.g. the root of the app)
</p>
stroom-proxy/stroom-proxy-app/src/main/java/stroom/proxy/app/servlet/ProxySecurityFilter.java