Closed kristjanmar closed 2 years ago
Maybe a "trailingSlash: true" option in the PlausibleProxyOptions would be the simplest way to account for this. I'm sure a lot of NextJS users have the trailingSlash option enabled.
https://nextjs.org/docs/api-reference/next.config.js/trailing-slash
Currently this redirect is causing an extra network request, plus delaying the "event" being tracked by about 100-150ms according to my testing.
Plausible has already mentioned for this in their own NextJS integration docs:
Thanks @kristjanmar for reporting this!
I fixed it and published as next-plausible@3.1.9
.
Please let me know if it works.
Regards
By the way, you don't have to do anything for this to work. It will automatically pick up the trailingSlash
option from nextConfig
.
Yes, it is working! Thanks for fixing this so quickly.
I'm setting up Plausible on my NextJS site (using Vercel).
Using the default settings in next.config.js to set up the proxy:
When visiting a page on my site, the page request to /api/event gets 308 redirected from /api/event to /api/event/ because I have "trailingSlash: true" in my next.config.js.
See screenshot: