Closed KittySparkles closed 1 year ago
Hey @KittySparkles,
I've fixed this and published as next-plausible@3.7.1
.
Please let me know if it works now.
Hey @4lejandrito! I implemented the changes in https://github.com/Stormbound-Games/stormbound-kitty/pull/1286 and it seems like it works! Thank you so much for fixing it so rapidly. Perhaps I should have reported this a long time ago. 😅
No worries. Thanks!!
Hello @4lejandrito!
Opening this issue following your comment.
For some reason, the
cache-control
HTTP header for the proxied script is set topublic, max-age=3600
. While it’s not terrible per se, it’s rather short for a script which doesn‘t really change much overall.I tried overwriting that value with a header definition in the Next.js configuration, to no avail:
Ultimately, this “forced” me to bypass the `withPlausibleProxy` utility altogether and handle the integration like this — in case you’re interested.
```js // Author the rewrites manually instead of using `withPlausibleProxy` because // it proxies https://plausible.io/js/plausible.exclusions.js, which has a // 3,600 seconds cache instead of the script below (as recommended in the // documentation) which has a 86,400 seconds cache. Additionally, it proxies // all the other plugin variants which we don’t need. // See: https://github.com/4lejandrito/next-plausible/blob/c01d2bfab71c60cc8893bcc83225467e37bd5f8c/index.tsx#L42 async rewrites() { return [ { source: '/js/script.exclusions.js', destination: 'https://plausible.io/js/script.exclusions.js', }, { source: '/proxy/api/event', destination: 'https://plausible.io/api/event', }, ] }, ``` As well as this public runtime config up to but excluding 3.7.0 (which broke this behavior as outlined [in this comment](https://github.com/4lejandrito/next-plausible/commit/1c8839d711de0df4048a2ee7c8e7c42f06413921#commitcomment-97581341)): ```js publicRuntimeConfig: { // This is necessary, otherwise the rendered script by the Plausible context // is `plausible.*.js` which has a 3,600 seconds cache instead of a 86,400 // seconds cache. nextPlausiblePublicProxyOptions: { scriptName: 'script' }, }, ``` And in 3.7.0: ```js env: { // This is necessary, otherwise the rendered script by the Plausible context // is `plausible.*.js` which has a 3,600 seconds cache instead of a 86,400 // seconds cache. next_plausible_proxy: 'true', next_plausible_scriptName: 'script', }, ```I couldn’t figure out what and where this
cache-control
header came from. I was wondering whether we could make this customizable, or perhaps increase it to a higher value?Thank you. ✨