Skip to content

Commit

Permalink
Add compression to dev environment to match production configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonFrings committed Jun 18, 2024
1 parent b80724a commit 037818b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,17 @@ pull:

serve: build
docker run -it --rm -p 8080:80 -v "$$PWD"/build:/usr/local/apache2/htdocs/ httpd:2.4-alpine sh -c \
"echo 'LoadModule rewrite_module modules/mod_rewrite.so' >> conf/httpd.conf;sed -i 's/AllowOverride None/AllowOverride All/' conf/httpd.conf;httpd -DFOREGROUND"
"echo 'LoadModule rewrite_module modules/mod_rewrite.so' >> conf/httpd.conf && \
echo 'LoadModule deflate_module modules/mod_deflate.so' >> conf/httpd.conf && \
echo 'LoadModule brotli_module modules/mod_brotli.so' >> conf/httpd.conf && \
echo 'AddOutputFilterByType BROTLI_COMPRESS;DEFLATE text/html' >> conf/httpd.conf;sed -i 's/AllowOverride None/AllowOverride All/' conf/httpd.conf;httpd -DFOREGROUND"

served: build
docker run -d --rm -p 8080:80 -v "$$PWD"/build:/usr/local/apache2/htdocs/ httpd:2.4-alpine sh -c \
"echo 'LoadModule rewrite_module modules/mod_rewrite.so' >> conf/httpd.conf;sed -i 's/AllowOverride None/AllowOverride All/' conf/httpd.conf;httpd -DFOREGROUND"
"echo 'LoadModule rewrite_module modules/mod_rewrite.so' >> conf/httpd.conf && \
echo 'LoadModule deflate_module modules/mod_deflate.so' >> conf/httpd.conf && \
echo 'LoadModule brotli_module modules/mod_brotli.so' >> conf/httpd.conf && \
echo 'AddOutputFilterByType BROTLI_COMPRESS;DEFLATE text/html' >> conf/httpd.conf;sed -i 's/AllowOverride None/AllowOverride All/' conf/httpd.conf;httpd -DFOREGROUND"
@sleep 2
@echo Container running. Use \"docker rm -f {containerId}\" to stop container.

Expand Down
10 changes: 9 additions & 1 deletion tests/integration.bash
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,17 @@ skipif() {

# check index endpoint

curl -v $base/
curl -v $base/ --compressed
match "HTTP/.* 200"
match -iP "Content-Type: text/html[\r\n]"
match -iP "Content-Encoding: br[\r\n]"
match -iP "Vary: Accept-Encoding[\r\n]"

curl -v $base/ --compressed -H 'Accept-Encoding: gzip, deflate'
match "HTTP/.* 200"
match -iP "Content-Type: text/html[\r\n]"
match -iP "Content-Encoding: gzip[\r\n]"
match -iP "Vary: Accept-Encoding[\r\n]"

curl -v $base/invalid
match "HTTP/.* 404"
Expand Down

0 comments on commit 037818b

Please sign in to comment.