You can add multiple origins in the same ImageKit.io account. URL endpoints allow you to configure which origins are accessible through your account and set their preference order as well.
When you signup, a default URL endpoint is created in your ImageKit.io dashboard. The default URL endpoint is always
https://ik.imagekit.io/your_imagekit_id. The first origin that you add automatically becomes accessible through this default URL endpoint.
You can add multiple URL endpoints and control which origins are accessible over which URL endpoint. You can create a one-to-one mapping between origin and URL endpoints or add multiple websites (origins) behind a single URL endpoint.
Here are the steps to add a new URL endpoint:
Go to the external storage in your ImageKit.io dashboard, and under the URL-endpoints section, click on the "Add origin" button.
Fill the identifier field. It will become part of the URL endpoint. So, supposing you want to create a URL-endpoint just to access product images bucket, and you want it to be like
https://ik.imagekit.io/your_imagekit_id/product-images/ , then enter product-images in this field.
Enter a description. This is just for you to add a note for the URL endpoint and will appear in the list of endpoints.
Now define the sequence of origins for this URL endpoint.
The first origin is always ImageKit.io Media Library (or internal cache) and cannot be changed.
Choose the second origin, which would be our Product images bucket.
A single URL endpoint can be configured to fetch an image from multiple image origins. You can decide the order in which ImageKit.io should try to access images from these origins.
Let's understand this with an example. When an image is requested at
https://ik.imagekit.io/your_imagekit_id/rest-of-the-path.jpg, here is what happens:
rest-of-the-path.jpg is first looked in our internal caches and storage, i.e., ImageKit.io Media Library. If the image is found, a response is returned. If not:
Second image origin is accessed, i.e., S3 bucket product images. If the image is found, a response is returned. If not, we move to the third origin.
Third image origin is accessed, i.e., Legacy load balancer. If the image is found, a response is returned. If not, a default image, or
404 response is returned as there are no more image origins to fetch the image.
You can configure a custom domain for a particular URL endpoint. Once a custom domain is configured on your account, it is an alias for the default URL endpoint
https://ik.imagekit.io/your_imagekit_id. So, if you create new URL endpoints, with different Identifier values, then you would just need to add the identifier in your image URL along with the custom domain name.
ik.imagekit.io or the ImageKit.io ID no longer appears in the URL.
You can also configure multiple custom domains and create a one-to-one mapping with the URL endpoints.
For example, in the screenshot below, we have two URL-endpoints:
One is default URL-endpoint -
https://ik.imagekit.io/your_imagekit_id. This is associated with a custom domain
https://images.example.com. So your image URL would become
And the second one is -
https://ik.imagekit.io/your_imagekit_id/product-images. This is associated with a custom domain
https://products.example.com. So your image URL would become
https://products.example.com/rest-of-the-path.jpg. Note that with products.example.com, which is mapped to a particular URL endpoint, you do not have to add the endpoint identifier (product-images) in the image URL.