Web server origin

Any web server which is accessible over HTTP or HTTPS can be configured as an origin in ImageKit.io. This allows you to use ImageKit.io's real-time image optimization and transformation features on all existing images.

How to add a web server origin?

  1. Go to the integration section of your ImageKit.io dashboard and click on the "Add origin" button.

  2. Give your origin a name, it will appear in the list of origins you have added. For example - Website load balancer.

  3. Fill out the base URL, for example, if your current image URL is https://www.example.com/rest-of-the-path.jpg, then enter https://www.example.com as the base URL.

  4. Leave the advanced options as it is, for now.

  5. Click on Submit button.

The newly added origin will start appearing under image origin list in the integration section of ImageKit.io dashboard. Similarly, you can add multiple origins to the same account.

🧙♂Whitelist request from ImageKit.io Make sure there your firewall or web-server is accessible from ImageKit.io.

Whitelist request from ImageKit.io

If you have deployed a WAF, you need to whitelist requests coming from ImageKit.io servers.

We recommend you to whitelist our requests to your origin based on request header value. All our requests to your origin will have a header x-req-from with its value set to imagekit.

Below is a list of IP addresses currently used by ImageKit.io to fetch images from your origin:

Note that these IP addresses are subject to change in the future. Any changes will be reflected and updated in this document.

Access the image through ImageKit.io URL-endpoint

Let's assume the original image URL is https://www.example.com/rest-of-the-path.jpg. The same image can be accessed through ImageKit.io default URL-endpoint now - https://ik.imagekit.io/your_imagekit_id/rest-of-the-path.jpg

We just replaced the old base URL https://www.example.com with the new ImageKit.io URL-endpoint, i.e., https://ik.imagekit.io/your_imagekit_id.

🧙♂Using custom domain You can also use a custom domain like images.example.com, but in this documentation, we will stick with https://ik.imagekit.io URL format. Learn more about how to use a custom domain.

Advanced options for web server origin

Include canonical response header

When enabled, the image response contains a Link header with the appropriate URL and rel=canonical. You will have to specify the base URL for the canonical header.

For example, if you set https://www.example.com as the base URL for canonical header, then the image response for URL https://ik.imagekit.io/your_imagekit_id/rest-of-the-path.jpg will have a Link header like this:

Link: <https://www.example.com/rest-of-the-path.jpg>; rel="canonical"

Forward Host header to this origin

By default, when ImageKit.io tries to get the image from your origin, the value of the Host header is the same as the base URL specified for the origin. For example, if the base URL is https://www.example.com, then the same gets forward to your origin.

However, when this setting is enabled, the host value from the image URL will be forwarded to the origin as the Host header. For example, if you are using a custom domain name for your image URLs, like static.example.com , then that is what gets forwarded to your host instead of www.example.com