Skip to content

Commit

Permalink
Merge pull request #41 from SimonFrings/compression
Browse files Browse the repository at this point in the history
Add compression to dev environment to match production configuration
  • Loading branch information
clue authored Jul 4, 2024
2 parents b80724a + 037818b commit c868fb2
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 c868fb2

Please sign in to comment.