Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Docker Run without "docker run"
<<'EOD' docker build --rm --tag rewrite-tester --no-cache -
FROM httpd:alpine
RUN set -e \
; sed -i -e 's/^#LoadModule rewrite_module/LoadModule rewrite_module/' \
-e 's/^LogLevel .*$/LogLevel debug rewrite:trace8/' \
-e '\|<Directory "/usr/local/apache2/htdocs">|,\ </Directory> s/^ AllowOverride .*$/ AllowOverride All/' \
/usr/local/apache2/conf/httpd.conf \
; echo -e ' \n\
RewriteEngine On \n\
RewriteBase / \n\
RewriteCond %{REQUEST_URI} \.(gif|jpg|jpeg|png)$ \n\
RewriteRule ^(.*)$ $1?i=jplx [DPI,QSA] \n\
RewriteCond %{REQUEST_URI} !^/sites/default/files/js/ \n\
RewriteCond %{REQUEST_URI} !^/sites/default/files/css/ \n\
RewriteRule ^sites/default/files/(.*)$ index.php?q=system/files/$1 [END,QSA,R] \n\
' | tee /usr/local/apache2/htdocs/.htaccess \
; httpd-foreground & sleep 1 \
; apk add curl \
; curl -I 'http://127.0.0.1/sites/default/files/Slide074.png?abc' \
; exit 123
EOD
;: https://stackoverflow.com/a/58527089/367456
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.