Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit config for .br files delivery instead of .css/.js #91

Open
andypost opened this issue Jun 13, 2023 · 5 comments · May be fixed by #92
Open

Unit config for .br files delivery instead of .css/.js #91

andypost opened this issue Jun 13, 2023 · 5 comments · May be fixed by #92

Comments

@andypost
Copy link
Contributor

andypost commented Jun 13, 2023

@andypost
Copy link
Contributor Author

Apache 2 config additions from https://www.drupal.org/project/drupal/issues/3184242

+    # Serve brotli compressed CSS files if they exist and the client accepts brotli.
+    RewriteCond %{HTTP:Accept-encoding} br
+    RewriteCond %{REQUEST_FILENAME}\.br -s
+    RewriteRule ^(.*css_[a-zA-Z0-9-_]+)\.css$ $1\.css\.br [QSA]
...
+    # Serve brotli compressed JS files if they exist and the client accepts brotli.
+    RewriteCond %{HTTP:Accept-encoding} br
+    RewriteCond %{REQUEST_FILENAME}\.br -s
+    RewriteRule ^(.*js_[a-zA-Z0-9-_]+)\.js$ $1\.js\.br [QSA]
...
+    RewriteRule \.css\.br$ - [T=text/css,E=no-gzip:1,E=no-brotli:1]
+    RewriteRule \.js\.br$ - [T=text/javascript,E=no-gzip:1,E=no-brotli:1]
...
+    <FilesMatch "(\.js\.br\|\.css\.br)$">
+      # Serve correct encoding type.
+      Header set Content-Encoding br
+      # Force proxies to cache compressed & non-compressed css/js files separately.
+      Header append Vary Accept-Encoding
+    </FilesMatch>

@andypost
Copy link
Contributor Author

Nginx already has it skilld-labs/skilld-docker-nginx@7d769dd

@andypost andypost linked a pull request Jun 14, 2023 that will close this issue
@andypost
Copy link
Contributor Author

We also should add static delivery for .well-known

@andypost
Copy link
Contributor Author

also it needs to skip logging for images
https://unit.nginx.org/news/2024/unit-1.32.0-released/#conditional-access-logging

@andypost
Copy link
Contributor Author

Gzip commited df6bfe5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant