Home
Support Forums

Error in Cache on-demand function redirect from another netlify site

Hello, I am having problems with the cache although I really do not know if it is this, when I visit the application that I do sometimes it shows previous versions.

This is how my project works:

  1. I have a netlify site with a generator function
https://on-demand-gix-ec-business.netlify.app/.netlify/builders/generator

1.1 This function has an internal redirect

/* /.netlify/functions/generate 200

1.2 A example:

https://on-demand-gix-ec-business.netlify.app/motransa/2884/#/

I have a call to a trigger that makes a construction when some of the data that the application depends on changes. In order to invalidate the builders cache

  1. I have a second site that redirects to this site (https://gix.netlify.app) but with a country prefix
/ec/* https://on-demand-gix-ec-business.netlify.app/:splat 200!

example: https://gix.netlify.app/ec/motransa/2884/
The problem:
When invalidating cache of the main site with the function under demand, and when visiting it from the secondary site there is inconsistency, I do not know if it is cache, or the CDN that is not returning previous versions.

I do not understand why this is. The expected behavior is that when invalidating the cache of the site with the generator function, and when visiting it from the site to do redirection, it shows me the latest version with the latest changes. Instead it is returning old versions at random.

I have no problems when visiting the main site that has the function under demand.

Hi @AndresGnu,

I’m getting a not found error for your site address. Have you deleted/renamed it?

Yes, I had to go into production. The problem occurs in the redirection to the construction path under demand.

Original route without redirection

https://gix-ec-personal.netlify.app/i/andresgnu/#/

this site has a buider with name generator and has one internal redirection

/i/* /.netlify/builders/generate 200

Site with redirection

https://gix-ec-business.netlify.app/i/andresgnu/#/

This site has one redirect to the original site

/i/* https://gix-ec-personal.netlify.app/i/:splat 200

When I make a change the change and generate a new construction to invalidate cache, everything is correct in the original site but the update is not propagated to the domain that does the redirect.

I don’t think this is supposed to work because Netlify doesn’t proxy more than once. Since you proxy once here:

/i/* https://gix-ec-personal.netlify.app/i/:splat 200

and that page is configured to proxy again to

/i/* /.netlify/builders/generate 200

this might not work.

I’ll still run this by the team to see if this is will work like you want it to.

But I tried to check otherwise, and I’m getting 404 for this:

https://gix-ec-personal.netlify.app/i/andresgnu/#/