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

✔️ Add Support for EWWW Image Optimizer's Nginx Rewriting Rules (WebP) #32

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion global/http.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,10 @@ sendfile on;
tcp_nopush on;

# Don't wait to send data in keep-alive state.
tcp_nodelay on;
tcp_nodelay on;

# Check if web browser supports WebP images
map $http_accept $webp_suffix {
default "";
"~*webp" ".webp";
}
8 changes: 7 additions & 1 deletion global/server/static-files.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@ location ~* \.(?:rss|atom)$ {
expires 1h;
}

# Use the WebP version of converted PNG/JPEG images
location ~* ^.+\.(png|jpe?g)$ {
add_header Vary Accept;
try_files $uri$webp_suffix $uri =404;
}

# Caches images, icons, video, audio, HTC, etc.
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|mp4|ogg|ogv|webm|htc)$ {
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|mp4|ogg|ogv|webm|htc|webp)$ {
expires 1y;
access_log off;
}
Expand Down