Skip to content

mvn appengine:stop does not work (ie emits error 411) #1067

@ludoch

Description

@ludoch

With newer Jetty web server a POST without Content-Length header emits an error 411. So the mvn appengine:stop command does not work anymore as AppEngine updated Jetty version to latest.

The fix is to explicitly setting Content-Length: 0 and closing the output stream without writing any newlines. This ensures that the shutdown request is strictly compliant with HTTP standards and avoids the 411 Length Required error on newer Jetty versions.

      // ...
      connection.setRequestMethod("POST");
      connection.setRequestProperty("Content-Length", "0"); // Explicitly set length
      connection.getOutputStream().close(); // Write empty body
      connection.disconnect();
      // ...

in

adminServerUrl = new URL("http", host, port, "/_ah/admin/quit");
near the POST to "/_ah/admin/quit" URL

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions