Route to alternative origin when a sticky origin is not available
The problem
I believe Styx is supposed to choose a different origin if one indicated by a sticky session cookie is no longer available.
But this is not happening. Instead says comes back with a BAD_GATEWAY etc error code.
Detailed description
The following, modified, StickySessionSpec test will fail:
test("Routes to new origin when the origin indicated by sticky session cookie is no longer available.") {
server1.stop()
val client: StyxBackendServiceClient = newHttpClientBuilder(backendService.id)
.loadBalancer(stickySessionStrategy(activeOrigins(backendService)))
.build
val request: LiveHttpRequest = get("/")
.cookies(requestCookie("styx_origin_app", "app-01"))
.build
val response = Mono.from(client.sendRequest(request)).block()
response.status() should be(OK)
response.cookies() should have size 1
val cookie = response.cookie("styx_origin_app").get()
cookie.value() should be("app-02")
cookie.path().get() should be("/")
cookie.httpOnly() should be(true)
cookie.maxAge().isPresent should be(true)
}
To clarify, when you say the test was modified, you mean fixed? That is, because the previous implementation seemed to stop server 1, but then make a request for server 2 (which tests nothing)?
Anyway, I agree, we are supposed to switch to a new origin, otherwise the user would have to clear their cookies to continue using the site.
However, we will want to ensure we make a good attempt to retry the bad server, because when we switch, the user will lose all their current session data*, so we don't want to do it too hastily.
* Typically one would use sticky-sessions if the servers do not share session data.
Solution could be to remove sticky origins.
Let's consider removing this feature.
Closing all issues over 3 years old. New issues can be created if problems are still occurring.