Skip to content

Commit 195ae30

Browse files
authored
Disable Express eTag response header for consistent FF behaviour across FF runtimes (#433)
The Express.js framework handles [eTags] (https://expressjs.com/en/api.html#app.settings.table) by default. Therefore, will respond with HTTP 304 Not Modified when a known eTag header value is present in a request with the same response. In all other Function Framework runtime implementations, this behavior is not implemented, and this caching behavior, which can be considered as an implementation detail, could be explicitly addressed by a developer as needed. This pull request aims make the NodeJs runtime version behaving the same as runtime implementations for GO, Java, Ruby, .Net Core, Python, and PHP.
1 parent 198faee commit 195ae30

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/server.ts

+4
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,13 @@ export function getServer(
9393
// Subsequent parsers will be skipped when one is matched.
9494
app.use(bodyParser.raw(rawBodySavingOptions));
9595
app.enable('trust proxy'); // To respect X-Forwarded-For header.
96+
9697
// Disable Express 'x-powered-by' header:
9798
// http://expressjs.com/en/advanced/best-practice-security.html#at-a-minimum-disable-x-powered-by-header
9899
app.disable('x-powered-by');
100+
101+
// Disable Express eTag response header
102+
app.disable('etag');
99103

100104
if (
101105
functionSignatureType === 'event' ||

0 commit comments

Comments
 (0)