Created
July 3, 2014 07:36
-
-
Save mosson/e0c25513cf65963807ee to your computer and use it in GitHub Desktop.
webp compatible on nginx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location = /logo { | |
if ($http_accept ~* "webp") { | |
add_header Vary Accept; | |
rewrite (.*) $1.webp last; | |
} | |
if ($http_user_agent ~* "(Chrome|Opera|Android|Android.*Chrome)") { | |
add_header Vary User-Agent; | |
rewrite (.*) $1.webp last; | |
} | |
rewrite (.*) $1.png last; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment