3

Just migrated to app engine flexible env for a java app which was running fine on standard env till now for last 3 years.

Encountered 502 bad gateway for a servlet call. Here is the short description - http://----.appspot.com/carSearch?

Similar servlets returning same data (JSON) work fine but this does not. Tried using OutpoutStream / PrintWriter but none of them worked.

The only difference from other servlets is I am saving the data in session and then returning it. Cloudflare confirmed the issue as caused by origin server.

speedplane
  • 15,673
  • 16
  • 86
  • 138

1 Answers1

0

I had a similar issue. It turns out that I have a root javax.servlet.Filter which blocks calls to internal AppEngine URLs. I solved it like this:

@Override
public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws ServletException, IOException
{
    HttpServletRequest request = (HttpServletRequest) req;
    HttpServletResponse response = (HttpServletResponse) resp;

    String path = request.getRequestURI();

    if(path.startsWith("/_ah/")) // bypass AppEngine internal requests
    {
        chain.doFilter(request, response);
        return;
    }

    // ...
}
Eng.Fouad
  • 115,165
  • 71
  • 313
  • 417