Skip to content
This repository was archived by the owner on Jul 12, 2023. It is now read-only.
This repository was archived by the owner on Jul 12, 2023. It is now read-only.

RFC: "somewhat experimental" #92

@jgara

Description

@jgara

Objective: Determine usefulness / necessity for the following code block in catalyst's /etc/httpd/conf.d/01_catalyst.conf:

  ### TODO: research
  # Let apache serve the pre-compiled .gz version of static assets,
  # if available, and the user-agent can handle it. Set all headers
  # correctly when doing so.
  #
  # SOMEWHAT EXPERIMENTAL. If you think it's causing problems,
  # just remove the following three LocationMatch.
  <LocationMatch "^/assets/.*\.(css|js)$">
    RewriteEngine on

    # Make sure the browser supports gzip encoding before we send it,
    # and that we have a precompiled .gz version.
    RewriteCond %{HTTP:Accept-Encoding} \b(x-)?gzip\b
    RewriteCond %{REQUEST_FILENAME}.gz -s
    RewriteRule ^(.+)$ $1.gz
  </LocationMatch>

  # Make sure Content-Type is set for 'real' type, not gzip,
  # and Content-Encoding is there to tell browser it needs to
  # unzip to get real type.
  #
  # Make sure Vary header is set; while apache docs suggest it
  # ought to be set automatically by our RewriteCond that uses an HTTP
  # header, does not seem to be reliably working.
  <LocationMatch "^/assets/.*\.css\.gz$">
      ForceType text/css
      Header set Content-Encoding gzip
      Header add Vary Accept-Encoding
  </LocationMatch>

  <LocationMatch "^/assets/.*\.js\.gz$">
      ForceType application/javascript
      Header set Content-Encoding gzip
      Header add Vary Accept-Encoding
  </LocationMatch>

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions