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

SnappyMail does not work #335

Open
hifihedgehog opened this issue Sep 20, 2022 · 1 comment
Open

SnappyMail does not work #335

hifihedgehog opened this issue Sep 20, 2022 · 1 comment

Comments

@hifihedgehog
Copy link

hifihedgehog commented Sep 20, 2022

See the-djmaze/snappymail#525. Per @the-djmaze's direction, I made some changes to get SnappyMail to work. Namely, I deleted the .htaccess file that optimizes SnappyMail for fast load times with precompressed files. I would like to serve these files and that requires .htaccess. See below for more details.

@hifihedgehog
Copy link
Author

hifihedgehog commented Sep 21, 2022

With @the-djmaze's help, I was able to pinpoint the problem file which is .htaccess located under the directory public_html/snappymail/v/2.N.N/static/. The file contents are so:

<IfModule mod_headers.c>
	<IfModule mod_rewrite.c>
		RewriteEngine On

		RewriteCond %{HTTP:Accept-encoding} br
		RewriteCond "%{REQUEST_FILENAME}\.br" -s
		RewriteRule "^(.+\.js)$" "$1\.br" [L,T=application/javascript,QSA]

		RewriteCond %{HTTP:Accept-encoding} gzip
		RewriteCond "%{REQUEST_FILENAME}\.gz" -s
		RewriteRule "^(.+\.js)$" "$1\.gz" [L,T=application/javascript,QSA]

		RewriteCond %{HTTP:Accept-encoding} br
		RewriteCond "%{REQUEST_FILENAME}\.br" -s
		RewriteRule "^(.+\.css)$" "$1\.br" [L,T=text/css,QSA]

		RewriteCond %{HTTP:Accept-encoding} gzip
		RewriteCond "%{REQUEST_FILENAME}\.gz" -s
		RewriteRule "^(.+\.css)$" "$1\.gz" [L,T=text/css,QSA]

		<FilesMatch "(\.js\.br|\.css\.br)$">
			SetEnv no-gzip 1
			SetEnv no-brotli 1
			# Serve correct encoding type.
			Header append Content-Encoding br
			# Force proxies to cache brotli &
			# non-brotli css/js files separately.
			Header append Vary Accept-Encoding
		</FilesMatch>

		<FilesMatch "(\.js\.gz|\.css\.gz)$">
			SetEnv no-gzip 1
			SetEnv no-brotli 1
			# Serve correct encoding type.
			Header append Content-Encoding gzip
			# Force proxies to cache gzipped &
			# non-gzipped css/js files separately.
			Header append Vary Accept-Encoding
		</FilesMatch>

		<FilesMatch "(\.js\.br|\.js\.gz)$">
			Header set Content-Type "application/javascript; charset=utf-8"
			ForceType application/javascript
		</FilesMatch>
		<FilesMatch "(\.css\.br|\.css\.gz)$">
			Header set Content-Type "text/css; charset=utf-8"
			ForceType text/css
		</FilesMatch>
	</IfModule>
</IfModule>

If I delete the .htaccess file, SnappyMail miraculously works. However, it should work without deleting this file. Technically, OpenLiteSpeed now supports .htaccess files but it does so with changes. Ideally, I want to use it so I can serve the precompressed files. How could this .htaccess file be made to work within the constraints of OpenLiteSpeed?

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

No branches or pull requests

1 participant