Home
Support Forums

[SOLVED] Error 500 for some _redirects (POST)

Hello,

I have a pretty simple _redirect for camping-arolla-2018

/misc/js/script.js https://plausible.io/js/plausible.outbound-links.js 200
/misc/api/event https://plausible.io/api/event 200

I can see error 500 (see screenshot for POST error).

I’ve read other error 500 post but no explanations seems to fit my use case.

Any idea / tip / help would be helpful. Thanks.

$ curl -I https://www.camping-arolla.com/misc/api/event
HTTP/2 500 
server: Netlify
age: 0
x-nf-request-id: 3016a1f8-d520-4f57-874b-ceadfac73d00
date: Wed, 26 May 2021 12:23:14 GMT

$ curl -I https://www.camping-arolla.com/misc/js/script.js
HTTP/2 200 
age: 0
cache-control: max-age=3600,public
content-length: 1830
content-type: application/javascript
cross-origin-resource-policy: cross-origin
date: Wed, 26 May 2021 12:23:42 GMT
server: Netlify
x-nf-request-id: 396518f1-e04a-41e9-b78f-be514dafd0cb

Hey! I’m cURLing the URL now and seeing a 404 which makes sense, as raw requests to the path also return a 404.

The 500 error is/was likely returned by the proxied path itself!

1 Like

That’s weird.
Thanks a lot for your response and your analysis time.

1 Like

@Scott plausible had some deep investigations about this.

Original ticket is here : Proxy with Netlify : Error 500 for some _redirects (POST) · Issue #1085 · plausible/analytics · GitHub

And they made a post about what they foud : here

This is what they found. Seems DNS related.

============
This issue does not seem related to the proxy settings to me. When requesting plausible.io/js/plausible.js itself, sometimes it fails even with curl. The request hangs forever and after 28 seconds you get a 500 timeout from the proxy.

It’s worth noting that the plausible.io domain is on Netlify as well.

Here’s how it looks when the request hangs with curl in verbose mode:

➜ analytics git:(master) curl -v https://plausible.io/js/plausible.outbound-links.js

  • Trying 206.189.52.23…
  • TCP_NODELAY set
  • Trying 2a05:d014:275:cb02:66df:50b:6e56:a6bf…
  • TCP_NODELAY set
  • Immediate connect fail for 2a05:d014:275:cb02:66df:50b:6e56:a6bf: Network is unreachable
  • Trying 2a05:d014:275:cb01:1f85:932b:b797:22f9…
  • TCP_NODELAY set
  • Immediate connect fail for 2a05:d014:275:cb01:1f85:932b:b797:22f9: Network is unreachable
  • Trying 2a05:d014:275:cb02:66df:50b:6e56:a6bf…
  • TCP_NODELAY set
  • Immediate connect fail for 2a05:d014:275:cb02:66df:50b:6e56:a6bf: Network is unreachable
  • Trying 2a05:d014:275:cb01:1f85:932b:b797:22f9…
  • TCP_NODELAY set
  • Immediate connect fail for 2a05:d014:275:cb01:1f85:932b:b797:22f9: Network is unreachable
  • Trying 2a05:d014:275:cb02:66df:50b:6e56:a6bf…
  • TCP_NODELAY set
  • Immediate connect fail for 2a05:d014:275:cb02:66df:50b:6e56:a6bf: Network is unreachable
  • Trying 2a05:d014:275:cb01:1f85:932b:b797:22f9…
  • TCP_NODELAY set
    etc. etc.

When the DNS query resolves to 206.189.50.215 the request seems to hang at the TCP connection phase. When the DNS query resolves to a different IP address, everything works fine. I’m not sure what’s going on with that IP address, but it’s unresponsive.

And an other behaviour:

=========
Seems like it’s not just one IP address that’s affected. Here’s another failure:

➜  analytics git:(master) curl -v https://plausible.io/js/plausible.outbound-links.js
*   Trying 2a05:d014:275:cb02:66df:50b:6e56:a6bf...
* TCP_NODELAY set
* Immediate connect fail for 2a05:d014:275:cb02:66df:50b:6e56:a6bf: Network is unreachable
*   Trying 2a03:b0c0:3:d0::d22:8001...
* TCP_NODELAY set
* Immediate connect fail for 2a03:b0c0:3:d0::d22:8001: Network is unreachable
* Closing connection 0
curl: (7) Couldn't connect to server

This time it didn’t hang. Instead it failed fast.

Hey there,

I did some digging. I could see cache invalidation on the https://plausible.io/ site (we’re serving content from different deploys) likely because they are defeating our caching headers.

Our default is: Cache-Control: public, max-age=0, must-revalidate

On /js/plausible.outbound-links.js for example, they’re using: Cache-Control: max-age=3600,public

And here’s why that’s important.

I’ve managed to purge the CDN cache for your site, and the plausible site, and I’m no longer returning 500 responses on any node. However, this will almost certainly arise again with the cache-busting header in place.

1 Like

Ahhh. Makes sense. Thanks.
I gave your response to plausible. Will see.

1 Like

Hi, Plausible developer here.

Thanks for all your help. I’ve now changed our origin to not include any Cache header at all. I can see from responses through Netlify that the default Cache-Control: public, max-age=0, must-revalidate is used.

The old header was present over the last week and @divinerites is seeing some errors again. Could you purge the cache again? Thanks.

2 Likes

I can confirm that a this time I still get 500 errors.

So If I may ask, my sites for cache purge are :

  • camping-arolla-2018
  • cocoon-meghna
  • lachotte
  • georgieff-osteo
  • cp-videos

And plurisante202 (www.plurisante202.fr) on an other netlify account.

Thanks a lot.

Hi,

for the cache purging, please add - re-sourcing.netlify.app, as I’m getting the 500 errors, also.

Caches purged for all aforementioned sites. Cheers!

1 Like

Thanks a lot @Scott
All my sites are now 200/202 whatever I do.
Thanks a lot for helping debug and the solution.

1 Like

Is this still an issue? I just set up these redirects, and I’m getting 500s back. If it is this, could you please purge cache for trackshare.app (if it matters, I’ve also got branch deploys development.trackshare.app and staging.trackshare.app). Thanks!

Example x-nf-request-id: 01FAX126SW4KRQVXQ7ZVN5M2Y6

hi there, we purged the cache for those sites - let us know if that doesn’t work for you!

Do we need to request the cache be purged for any site that uses Plausible with a redirect as described here? And does the cache need to be purged on every deploy?

My understanding is that is needed only if you had setup proxy before june 3 when plausible changed their setup. And if needed then purge only once.

@perry can you please purge the cache for:

I setup the redirect on June 4th, but am getting 500s on the Plausible redirects. Only if I hit the redirect a few times manually does it start to work.

Hey there, @Brett_DeWoody :wave:

We have purged those! Thanks for reaching out :slight_smile:

Thank you @hillary. I’m still getting the error on my site routinely. It’s an odd issue. In my case I have a redirect for the Plausible analytics script. On some of my pages I have an onClick event to track an event in Plausible. When clicking these elements the error of “Plausible is not defined” occurs on the first few clicks, but then works after a few clicks.

hey there, @Brett_DeWoody

Thanks for coming back and letting us know! Sorry to hear you are still having issues with this. Could you send over some additional information, such as your repo, screenshots, or a way for us to recreate this issue so that we can look into it further? We would appreciate it!