question-mark

Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Proxy /api/event routes using withPlausibleProxy for custom domains

See original GitHub issue

Issue Description

Using withPlausibleProxy the URL rewrite rules are applied. Additionally a custom domain can be set. However, I think it would also make sense to rewrite the POST /api/event requests. As the script can be loaded but all plausible events are still being blocked.

<PlausibleProvider domain="http://plausible.example.com">
    ...
</PlausibleProvider>
const { withPlausibleProxy } = require('next-plausible')

module.exports = withPlausibleProxy({
  customDomain: 'http://plausible.example.com',
})({
  // ...your next js config, if any
})

This will proxy the GET request of fetching the script.js but e.g. the event POST requests are going to http://plausible.example.comand are still being blocked.

When self-hosting plausible it is currently only possible to host it on root path as no base path can be set, see discussion.

So I think it would be great if we could also proxy the event requests.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:16 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
thacooncommented, Nov 7, 2021

@4lejandrito I also receive the right script now and proxying works on my site, thanks for your time +1

1reaction
4lejandritocommented, Nov 5, 2021

Using the latest version of the docker image as of today I receive the right script, processing the data-api attribute correctly. Maybe you need to clear your docker cache to actually get the latest version?

@seeARMS, @thacoon

Read more comments on GitHub >

github_iconTop Results From Across the Web

Proxying Plausible through Vercel with Next.js
There are two ways you can proxy Plausible through Next.js / Vercel. One is using the next-plausible npm package and the other is...
Read more >
Set up a custom domain proxy for Analytics.js - Segment
Custom domains allow you to proxy Analytics.js and proxy all tracking event requests through your domain.
Read more >
4lejandrito/next-plausible: Simple integration for https ... - GitHub
PlausibleProvider Props ; domain, The domain of the site you want to monitor. ; customDomain, Set this if you use a custom domain...
Read more >
Using a Custom Domain And Certificate for your API Proxy in ...
In this video I show step by step how to configure an Apigee API Proxy to use a custom domain and certificate. First,...
Read more >
Using next-plausible to proxy POST requests to Plausible ...
Hi all, I'm in the process of finishing off a Next.js site ... A GET request to the proxy URL returns Plausible's 404...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found