Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions blueprints/sticky-sessions.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
date: 2024-07-17
---

<div class="important">
The methods described in this Blueprint won't work with a [Bluegreen deployment strategy](https://fly.io/docs/launch/deploy/#deployment-strategy) because all the Machines in your app are replaced—the old Machines are destroyed and their IDs are no longer relevant.

Check failure on line 10 in blueprints/sticky-sessions.html.md

View workflow job for this annotation

GitHub Actions / Vale linter

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'bluegreen' instead of 'Bluegreen'. Raw Output: {"message": "[Vale.Terms] Use 'bluegreen' instead of 'Bluegreen'.", "location": {"path": "blueprints/sticky-sessions.html.md", "range": {"start": {"line": 10, "column": 60}}}, "severity": "ERROR"}
</div>

In a number of scenarios, it is important to ensure that certain requests are
routed to a specific Machine. This frequently is expressed in the form of
wanting an entire user's session to be processed by the same Machine.
Expand Down Expand Up @@ -66,7 +70,7 @@

This approach can be implemented entirely on the server. This will require an additional "hop" to route requests and [is limited to payloads of 1 megabyte](https://fly.io/docs/networking/dynamic-request-routing/#limitations).

The example below creates [Express Middleware](https://expressjs.com/en/guide/using-middleware.html) that creates cookies containing the desired Machine id, and then replays requests that arrive at the wrong destination:

Check failure on line 73 in blueprints/sticky-sessions.html.md

View workflow job for this annotation

GitHub Actions / Vale linter

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'middleware' instead of 'Middleware'. Raw Output: {"message": "[Vale.Terms] Use 'middleware' instead of 'Middleware'.", "location": {"path": "blueprints/sticky-sessions.html.md", "range": {"start": {"line": 73, "column": 36}}}, "severity": "ERROR"}

```js

Expand Down
Loading