Skip to content
This repository was archived by the owner on Feb 15, 2022. It is now read-only.
This repository was archived by the owner on Feb 15, 2022. It is now read-only.

Both cases of code output is "for all responses" #5

@Malvoz

Description

@Malvoz

Taking Apache as an example, the code output may look like this:

# for all responses
<IfModule mod_headers.c>
  Header set "Cache-Control" 'no-cache'
</IfModule>

# for single response
Header set "Cache-Control" 'no-cache'

Actually both these cases set the header for all responses.

If you want a header only to be included in a response for certain files based on file extension you could use e.g. <FilesMatch>, or preferably based on MIME type using expr.

<IfModule mod_headers.c>

  # Based on file extension:
  <FilesMatch "\.(htm|html)$">
    Header set Cache-Control "no-cache"
  </FilesMatch>

  # Based on MIME-Type:
    Header set Cache-Control "no-cache" "expr=%{CONTENT_TYPE} =~ m#text/html#i

</IfModule>

Perhaps there could be an option to choose which MIME-types or file extensions the build should apply to?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions