1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
unleash.unleash/src
Zachary Skalko 9903cf1090
fix: Add appropriate response headers to SPA entry point HTML response (#6992)
## About the changes

Current state, when returning the HTML entry point from the server,
there are no headers attached. We encountered an issue with a deployment
and this had an impact for us.

A brief description:

1. We deployed the most recent version. Noticed an unrelated issue.
2. Users tried to use the most recent version and due to their client
cache, requested assets that did not exist in the newest version.
3. Our cache layer cached the assets that were not there with the HTML
response. It had to infer the type based on the filename because there
was no attached `Content-Type` header. This cache was very sticky.
4. After rolling back we saw the HTML response (from the cache) instead
of the appropriate response from the upstream Unleash application.

This PR does a few things.

1. When responding with the HTML entry point, it adds header
(`Content-Type: text/html`).
2. When the client is requesting an asset (a path that ends with an
extension), it also instructs the resource not to be cached
(`Cache-Control: no-cache`) and returns a 404. This will prevent misses
from getting cached.


## Discussion points

To me, there doesn't seem to be a lot of test infra on serving the SPA
application. If that is an error, please indicate where that is and an
appropriate test can be added.
2024-05-15 15:07:07 +02:00
..
lib fix: Add appropriate response headers to SPA entry point HTML response (#6992) 2024-05-15 15:07:07 +02:00
mailtemplates
migrations feat: add status fields for feature lifecycle table (#7014) 2024-05-09 09:39:01 +03:00
test feat: expose postgres version (#7041) 2024-05-13 14:41:28 +02:00
migrator.ts
server-dev.ts
server.ts