A space to discuss online store customization, theme development, and Liquid templating.
Hi,
I want to build an app or plugin such that I can modify all the links to static resources on the shopify site to use my own CDN. I am quite new to Shopify, so could you give me some pointers?
I was looking into https://help.shopify.com/api/tutorials/application-proxies#add-a-proxy . Am I on the right track?
Thanks.
No. Using an App Proxy as your gateway to your CDN would be about a bad as you could architect something with Shopify platform.
Cannot answer your question directly, but your issue begs the question in return. Why on earth would you want to replace an excellent CDN built by and with world-class experts with something you cobble together?
No. Using an App Proxy as your gateway to your CDN would be about a bad as you could architect something with Shopify platform.
Hmm...could you explain more as to why? 🙂 I thought application proxies are the right way to do this because of the following excerpt from the documentation -
An application proxy is a feature that fetches and displays data on a Shopify shop page from an outside location that you, the developer, specify. For app developers, this means that the content on these proxy pages can be dynamic; capable of being updated as much as you feel necessary. App developers can use application proxies to display image galleries, statistics and custom forms, just to name a few examples.
Maybe I don't understand application proxies well enough. In that case, I will be grateful if you could please explain or point me to easy-to-understand resources for beginners 🙂
I want to use https://dexecure.com/ 🙂 It does a lot more than cache the assets at different geographical locations. Since a lot of e-commerce websites are on Shopify and some of my friends wanted to use Dexecure on their Shopify sites, I wanted to write an app or plugin that can easily cause the assets to be served (more likely, replace the asset URLs in the rendered HTML) from Dexecure servers. Is there a way to replace asset URLs in the rendered HTML via an app/plugin? 🙂
Ok.. go ahead with the Proxy. When Shopify gets a request, they will simply forward your call securely to the Proxy. So that takes time. Latency. No matter how fast your CDN is, you cannot speed that up. So now your Proxy has to generate the asset to return. Most people return either:
You seem to want assets. So that either means a proxy call per asset (typical CDN) or rendered dynamic HTML (not typical CDN)
Take a few minutes to play with the App Proxy and you'll learn why you might not want to use it.
No matter what, you are going to introduce latency and make your shop slower defeating the purpose of CDN. In my opinion a better architecture for you is to roll your own shop for your clients hooking it to your CDN and that will negate the extra layer involved, thus speeding things up (perhaps).
Is it not possible to replace the asset links in the html on the server before the rendering on the client happens? 🙂 This way, the resources etc., will be fetched from Dexecure, rather than Shopify. I do not want the client to send requests to Shopify and then to Dexecure, that seems wasteful. I would like the asset URLs to point to Dexecure directly 😄
Shopify platform is not too hard to understand. They render templates into HTML, piece by piece, bit by bit and deliver that gigantor string of content to browsers. They have a CDN far more integrated than yours. If you want to jimmy yours in, you will sacrifice all speed and rendering power, so why bother.
To use your own CDN, render your own shops. You cannot have a hosted service and selectively replace the hosted bits and pieces with your own.