A server farm runs the same web application on multiple servers. Requests can reach any server, so shared cryptographic material becomes essential: authentication cookies created by one server must be readable by the others. section 29.2
Configure shared data-protection keys when deploying across servers:
- Recognize the failure mode: each server uses its own key by default, so a server cannot decrypt authentication cookies issued by another server. section 29.2
- Store keys centrally so every server can use the same cryptographic material. section 29.2
- Choose an appropriate shared location, such as a shared folder, Redis, or Azure Blob Storage. section 29.2
Authentication across servers
A user signs in through one server and receives an authentication cookie. If a later request reaches another server, that server can authenticate the user only when both servers share data-protection keys. section 29.2
Figure 29.5 Protecting against a CSRF attack using antiforgery tokens. The browser automatically forwards the cookie token, but the malicious site can’t read it and so can’t include a token in the form. The app rejects the malicious request because the tokens don’t match.
Antiforgery tokens add another cross-server security consideration: the application must consistently protect and validate tokens when requests may reach different servers. section 29.2
