This PR contains the work done to add cache-control headers to static file responses by configuring the `FileMiddleware` middleware to tag served static files with *Cache-Control* directives, tuned per media type. To provide further details about the work done: * Added a cache control that sets per-type policies: text assets (CSS/JS) get public, max-age, must-revalidate; images get public, max-age; everything else gets a default public, max-age. * Files stay validated via `ETag/Last-Modified` header. * Made the max-age values configurable, with defaults, via new cache constants. Reviewed-on: rock-n-code/loud-amsterdam#6 Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
66 lines
2.2 KiB
Plaintext
66 lines
2.2 KiB
Plaintext
{
|
|
"version": 1,
|
|
"lineLength": 200,
|
|
"indentation": {
|
|
"spaces": 4
|
|
},
|
|
"tabWidth": 4,
|
|
"maximumBlankLines": 1,
|
|
"respectsExistingLineBreaks": true,
|
|
"lineBreakBeforeControlFlowKeywords": true,
|
|
"lineBreakBeforeEachArgument": true,
|
|
"lineBreakBeforeEachGenericRequirement": true,
|
|
"lineBreakBetweenDeclarationAttributes": true,
|
|
"prioritizeKeepingFunctionOutputTogether": false,
|
|
"indentConditionalCompilationBlocks": true,
|
|
"indentSwitchCaseLabels": false,
|
|
"lineBreakAroundMultilineExpressionChainComponents": false,
|
|
"spacesAroundRangeFormationOperators": true,
|
|
"multiElementCollectionTrailingCommas": true,
|
|
"fileScopedDeclarationPrivacy": {
|
|
"accessLevel": "private"
|
|
},
|
|
"noAssignmentInExpressions": {
|
|
"allowedFunctions": [
|
|
"XCTAssertNoThrow"
|
|
]
|
|
},
|
|
"rules": {
|
|
"AllPublicDeclarationsHaveDocumentation": false,
|
|
"AlwaysUseLowerCamelCase": true,
|
|
"AmbiguousTrailingClosureOverload": true,
|
|
"BeginDocumentationCommentWithOneLineSummary": true,
|
|
"DoNotUseSemicolons": true,
|
|
"DontRepeatTypeInStaticProperties": true,
|
|
"FileScopedDeclarationPrivacy": true,
|
|
"FullyIndirectEnum": true,
|
|
"GroupNumericLiterals": true,
|
|
"IdentifiersMustBeASCII": true,
|
|
"NeverForceUnwrap": true,
|
|
"NeverUseForceTry": true,
|
|
"NeverUseImplicitlyUnwrappedOptionals": true,
|
|
"NoAccessLevelOnExtensionDeclaration": false,
|
|
"NoAssignmentInExpressions": true,
|
|
"NoBlockComments": true,
|
|
"NoCasesWithOnlyFallthrough": true,
|
|
"NoEmptyTrailingClosureParentheses": true,
|
|
"NoLabelsInCasePatterns": true,
|
|
"NoLeadingUnderscores": false,
|
|
"NoParensAroundConditions": true,
|
|
"NoVoidReturnOnFunctionSignature": true,
|
|
"OneCasePerLine": true,
|
|
"OneVariableDeclarationPerLine": true,
|
|
"OnlyOneTrailingClosureArgument": true,
|
|
"OrderedImports": true,
|
|
"ReturnVoidInsteadOfEmptyTuple": true,
|
|
"UseEarlyExits": true,
|
|
"UseLetInEveryBoundCaseVariable": true,
|
|
"UseShorthandTypeNames": true,
|
|
"UseSingleLinePropertyGetter": true,
|
|
"UseSynthesizedInitializer": true,
|
|
"UseTripleSlashForDocumentationComments": true,
|
|
"UseWhereClausesInForLoops": false,
|
|
"ValidateDocumentationComments": false
|
|
}
|
|
}
|