Same origin problem / redirect problem

Hi i have read some articles and done some settings.
Seems all correct but i am having problem

Because of newbie link limit here is screenshot:

Which is not correct as i see here :
https://www. youtube. com/watch?v=0TNJYHbXT8s&t=782s

i mean everythings works but it redirect 301 and browser goes to gtm2.domain.com/healthy instead of staying domain.com/metrics/healthy

@hemato
I am in the same loop
did you manage to solve it?

Thanks

no one helped me about this issue . and i cancaled my subscription.

Sorry to hear that
Thank you for the update.

You seem to have used incorrect code in your worker.
Here is your code:

Here is code example form article:

@hemato
I found a solution that worked for us.

When your SSL /TLS encryption mode that Cloudflare uses to connect to the origin server is not set to FULL then you will get the endless loop.
Once you change it to FULL everything works as excepted.

Hope it will work for you as well.

1 Like

@Erez Thanks for the clarification of such a case.
We have added an additional item to the same origin setting to avoid such problems. You don’t have to switch the whole site to Full if you need to and do it only for same origin, item ‘e’ here:

This didn’t worked for me. Switching all site to full “SSL/TLS” made things better for me ( no more 301 redirects & header “Location” redirects ). Also I want to mention for people who are struggling with a infinite redirect loop to not switch to “Proxied” in CF the DNS related settings for Stape .

However I think the end result is still not right because I can still see the browser making one direct request to the 'Stape GTM server domain name: “https://set8.skinguru24.pl” instead of all requests going through “https://skinguru24.pl/set

This is fine, there is no point in loading js from the same origin and custom loader does not support this.
It is only important that you send all requests to your same origin path.

That is, if you use the transport url ‘https://skinguru24.pl/set’ and everything works correctly, you see events on the server container - then everything is done and working correctly.

I 've adjusted before the Cloudflare Worker code to replace the “Stape GTM server domain name” with my same origin path ( ‘https://skinguru24.pl/set’) in all .js files …and it seems it was working : i did see all the events in the stape.io container and there was no more connection from browser to https://set8.skinguru24.pl ( my Stape GTM server domain name ) .

But you’re saying that it’s okay for the browser to establish a connection to the ‘Stape GTM server domain name’ even when using same-origin … did I understand that correctly?

Yes, this is completely normal and actually has no effect on ITP or adblocker protection if you have scripts (gtm, gtag, etc) loaded from your subdomain set8.skinguru24.pl and not from your same origin path skinguru24.pl/set

In addition, this way you won’t send unnecessary requests to the worker.