-
-
Save stephenasamoah/4a20d0fd6d3721a24e7aec129106419c to your computer and use it in GitHub Desktop.
Embedded Google Analytics: Fix “Leverage Browser Caching” Warning 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
<html> | |
<!-- ... --> | |
<!-- Embed analytics.js as local file --> | |
<script src="/analytics.js"></script> | |
</html> |
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
server { | |
### ... | |
location = /analytics.js { | |
# Proxy to google-analytics.com | |
proxy_pass https://www.google-analytics.com; | |
# Custom expires time | |
expires 1y; | |
} | |
### ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment