How can we help?

How to use Own CDN on Stape

Ivanna
Ivanna

The option of using Own CDN helps, for example, to server your server GTM within the same IP as your website which prevents the latest WebKit version from decreasing first-party cookie lifetime

 

Below is an example of how you can configure Own CDN with CloudFlare. 

Please note that you can use any other DNS provider, and Cloudflare here is just one example.


1. Go to your Stape container setting and select Own CDN.

Screenshot 2024-07-24 at 15.10.37.png

 

2. Go to CloudFlare and configure CNAME record for the tagging server URL. Please make sure that Proxied is enabled. The setting should look like in the screenshot below. 

Screenshot 2024-04-23 at 15.34.36.png

 

3. Go to the Rules → Configuration Rules - create a new rule

  • Specify any name you like for the rule
  • Select ‘Custom filter expression’ 
    • Field: hostname
    • Operator: contains
    • Value: specify your sGTM subdomain. In our example is ‘gtm.stape.tools’

Screenshot 2024-05-29 at 12.15.29.png

Scroll down on this page and find the ‘SSL’ feature. Activate it with ‘Full’ option.

2.png

4. Go to the Rules →Transform Rules → Modify Request Header - create a new rule

  • Specify any name you like for the rule
  • Select ‘Custom filter expression’ 
    • Field: hostname
    • Operator: contains
    • Value: specify your sGTM subdomain, in our example, it is ‘gtm.stape.tools’

Screenshot 2024-05-29 at 12.18.54.png

In the modify headers section, specify:

  • Type: Set static
  • Header name: X-From-Cdn
  • Value: cf-stape4.png

Deploy changes

5. Go to the Caching → Cache Rules - create a new rule

 

  • Specify any name you like for the rule
  • Select ‘Custom filter expression’ 
    • Field: hostname
    • Operator: contains
    • Value: specify your sGTM subdomain. In our example, it is ‘gtm.stape.tools’

 

Cache eligibility: Bypass cache

Screenshot 2024-05-29 at 12.25.16.png

Deploy changes.

 

That's it, now all your requests to and from sGTM will be proxied through Cloudflare.

 

*If you are using a Web Application Firewall please make sure that it will not block these requests.

Was this article helpful?

7 out of 11 found this helpful

Have more questions? Submit a request

Comments

12 comments

  • Comment author
    Cécile James Merlin

    Good morning,

    I'm starting with Stape :)
    I find your explanation complicated.
    In Cloudflare your screenshot is not clear to me.

    AT STAPE
    Custom domain
    Domain Name: https://NAME.stape.io
    Own Cdn

    AT CLOUDFLARE
    CNAME > ss = NAME ? > .= ? stape.io > proxied true > auto TTL

    I am taking an example to show you what is difficult for me to understand in your explanation and how I configured this hazardous deduction, so can you tell me if it is correct?

    AT STAPE
    Domain Name: Https://gtm.mysite.com
    Own Cdn

    AT CLOUDFLARE
    DNS
    CNAME > gtm > mysite.com > proxied true > auto TTL

    PAGE RULE
    URL (required)
    https://mysite.com/metrics/*

    Currently and for 2 days in my container, my personalized domain is still being verified
    Kind regards
    CM

    0
  • Comment author
    Dmytro

    Hi,

    When creating a CNAME record in Target/Content, you need to specify the value specified in your container on Stape.


    In your case, the record should look like this:

    Type: CNAME
    Name: gtm
    Target/Content: eu.stape.io
    TTL: Auto
    Proxy status: true

    1
  • Comment author
    Gabriel

    This new server URL configuration update with CloudFlare messed things up for me.

    Before, using the old cache rules, having to use the DNS type A within CF and then switching to Own CDN within Stape, everything worked perfectly, with no cache bugs.

    My form always sent the correct date and time to Active, and I never had issues with capturing UTMs from people who signed up through my form. Life was smooth, and everything worked.

    After this configuration update, I decided to "update mine" and it was the worst thing I did.

    By deleting the old rules and removing the DNS type A to use the DNS type CNAME and the new rules, everything got worse.

    My site can't pull all UTMs correctly, the date and time in the Elementor form are always bugged, and to top it off, it's even bugging Active Campaign.

    Please, Stape, try to resolve this.

    0
  • Comment author
    Dmytro

    We’re sorry to hear that you’ve encountered such difficulties using own CDN for sGTM. But if you have done everything correctly - this setting simply proxies sGTM traffic through Cloudflare. There are not and should not be any dependencies for your forms or Active Campaign to work, only if you have configured something very incorrectly or you have additional settings/rules in CF for other functionality that conflict in some way.
    Our support team has also not received any such complaints from other users.
    I think if you have the opportunity to contact the developers - they will definitely be able to help you with identifying the source of the problem.

    0
  • Comment author
    Alahyane Said

    Thanks a lot for taking time and the effort to make this great resource! Will we still need to go through all of these steps if we choose Stape Global CDN instead of Own CDN?

    0
  • Comment author
    Dmytro

    Hello Said,

    To answer your first question:
    Stape Global CDN and Own CDN perform different functions, so you don't need to make these settings in Cloudflare if you choose Stape Global CDN.

    You just need to create the required DNS records to verify your custom subdomain.

    And your second question:
    Own CDN and Same origin domain perform the same function, so if you set up Own CDN, you don't need to set up Same origin domain as well.

    Hope this helps.

    1
  • Comment author
    Alahyane Said

    Hello, thank you for your reply!

    Still have one more doubt. Can I link my custom domain name using Own CDN and skip all of the steps mentioned in this article, and only apply same origin configuration? 👌🏻

    0
  • Comment author
    Dmytro M.

    Hi, Said

    Two tutorials are incompatible with each other.
    You either add a custom domain by choosing an Own CDN option, or set up the same origin using this tutorial https://stape.io/news/a-new-way-to-set-up-a-custom-domain-in-server-gtm

    Both ways help increase cookie lifetime by setting first-party cookies instead of third-party cookies. 

    Regards

    1
  • Comment author
    Alahyane Said

    Hi Dmytro,

    Thanks for the clarification, I have chosen to map a custom domain for the sGTM using Stape Global CDN and setup same origin config.

    Have a wonderful day

    0
  • Comment author
    Alahyane Said

    Hi again,

    As I mentioned in my previous comment, I am now working with same-origin config via Cloudflare. When I click on the preview button on my server-side GTM container I get a 404 page, but when I switch back to https:// metrics . mydomain . com, the GTM debugging page shows up. Do you know what could be the cause of that?

    Thank you.

    0
  • Comment author
    Dmytro M.

    Hi, Said

    Please write to us with full information at support@stape.io

    Regards

    1
  • Comment author
    Alahyane Said

    All right, thank you!

    0

Please sign in to leave a comment.