{"record":{"id":"1f295cc6ba987681","repo":"eclipse-vertx/vert.x","slug":"426-upgrade-required-rfc2817","errorCode":null,"errorMessage":"426 Upgrade Required (RFC2817)","messagePattern":"426 Upgrade Required \\(RFC2817\\)","errorType":"http","errorClass":null,"httpStatus":426,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/http/HttpResponseExpectation.java","lineNumber":265,"sourceCode":"  /**\n   * 423 Locked (WebDAV, RFC4918)\n   */\n  HttpResponseExpectation SC_LOCKED = status(423);\n\n  /**\n   * 424 Failed Dependency (WebDAV, RFC4918)\n   */\n  HttpResponseExpectation SC_FAILED_DEPENDENCY = status(424);\n\n  /**\n   * 425 Unordered Collection (WebDAV, RFC3648)\n   */\n  HttpResponseExpectation SC_UNORDERED_COLLECTION = status(425);\n\n  /**\n   * 426 Upgrade Required (RFC2817)\n   */\n  HttpResponseExpectation SC_UPGRADE_REQUIRED = status(426);\n\n  /**\n   * 428 Precondition Required (RFC6585)\n   */\n  HttpResponseExpectation SC_PRECONDITION_REQUIRED = status(428);\n\n  /**\n   * 429 Too Many Requests (RFC6585)\n   */\n  HttpResponseExpectation SC_TOO_MANY_REQUESTS = status(429);\n\n  /**\n   * 431 Request Header Fields Too Large (RFC6585)\n   */\n  HttpResponseExpectation SC_REQUEST_HEADER_FIELDS_TOO_LARGE = status(431);\n\n  /**\n   * Any 5XX server error","sourceCodeStart":247,"sourceCodeEnd":283,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/http/HttpResponseExpectation.java#L247-L283","documentation":"SC_UPGRADE_REQUIRED is an HttpResponseExpectation constant for HTTP 426 (RFC2817). The server requires the client to switch to a different protocol (e.g. HTTP to TLS) via the Upgrade header before retrying the request. Vert.x exposes it for status expectations on HttpClient requests.","triggerScenarios":"Sending a plain-HTTP request to a server that mandates TLS (responds 426 with an Upgrade header), or any endpoint requiring protocol upgrade before the request is accepted. Appears when .expecting(SC_UPGRADE_REQUIRED) is used to test upgrade behavior or when a non-ssl client hits an SSL-required server.","commonSituations":"Server hardened to require HTTPS after deprecating plain HTTP; misconfigured client still using http:// for an https-only endpoint; WebSocket endpoints requiring a proper Upgrade handshake.","solutions":["Switch the client request to TLS/HTTPS (RequestOptions setSsl(true), port 443).","Retry with the required Upgrade header and protocols listed in the 426 response.","Update hardcoded http:// URLs to https:// in configuration after server policy changes.","If testing upgrade behavior, keep the expectation; otherwise expect 101 Switching Protocols after a valid upgrade."],"exampleFix":"// before\nclient.request(new RequestOptions().setHost(\"api.example.com\").setPort(80))\n// after\nclient.request(new RequestOptions().setHost(\"api.example.com\").setPort(443).setSsl(true))","handlingStrategy":"fallback","validationCode":"if (\"http\".equals(requestOptions.getUri().substring(0, 4)) && serverRequiresTls) {\n  requestOptions.setSsl(true).setPort(443);\n}","typeGuard":"boolean is426(HttpClientResponse resp) { return resp.statusCode() == 426; }","tryCatchPattern":"plainRequest().onFailure(err -> {\n  if (isCauseStatus(err, 426)) retryWithUpgradeOrTls();\n});","preventionTips":["Prefer https endpoints by default","Read the Upgrade header on 426 and honor the listed protocols","Audit configs after TLS-enforcement changes","Test protocol-upgrade behavior in CI"],"tags":["http","tls","upgrade","vertx-http-client"],"backgroundTag":"http-error-status","analyzedSha":"fb308bd8c3f12c79f4ae89bef67fadf6c80d036e","analyzedAt":"2026-09-06T11:37:12.241Z","contentChangedAt":"2026-09-06T11:37:12.241Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}