Update readme for adblock bypass integration with plausible

This commit is contained in:
infidel 2022-04-11 22:29:30 +07:00
parent 25329df270
commit 5612c51bbd

View File

@ -15,7 +15,7 @@ This is infidel's fork version of hugo [Cupper](https://github.com/zwbetz-gh/cup
``` ```
#### params #### Hugo Conf
```yml ```yml
... ...
@ -24,6 +24,55 @@ This is infidel's fork version of hugo [Cupper](https://github.com/zwbetz-gh/cup
plsUrl : <Your Plausible script url> plsUrl : <Your Plausible script url>
... ...
``` ```
### Plausible Bypass Adblock
Adblocker easyfilter has some filter on “plausible.js” string, especially if its routed towards external source . To bypass this you can setup a proxy rule on nginx to redirect this plausible api into the currently accessed site.
### nginx conf
```nginx
server {
...
location = /js/script.js {
# Change this if you use a different variant of the script
proxy_pass https://plausible.io/js/script.js;
# Tiny, negligible performance improvement. Very optional.
proxy_buffering on;
# Cache the script for 6 hours, as long as plausible.io returns a valid response
proxy_cache jscache;
proxy_cache_valid 200 6h;
proxy_cache_use_stale updating error timeout invalid_header http_500;
# Optional. Adds a header to tell if you got a cache hit or miss
add_header X-Cache $upstream_cache_status;
}
location = /api/event {
proxy_pass https://plausible.io/api/event;
proxy_buffering on;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
}
}
```
### Hugo Conf
```yml
...
params:
plsDomain : <Your Domain>
plsUrl : /js/script.js
...
```
### PDF.js ### PDF.js