---
schema_version: "1"
id: 7edfd24823357feafa1fb99037ad8396ce95b35a15c42fba465f56981b413ef5
title: Honor Job Hostnames in Image URL Generation
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/cc/264-0-0/b2c_job_hostnames_image_urls.md
canonical_url: https://help.salesforce.com/s/articleView?id=cc.b2c_job_hostnames_image_urls.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: f3a896890531efb408107c7883b26085ebb341c1fbd9bdde7043b6c14452d46e
description: In a job context, such as a catalog export, B2C Commerce can generate image URLs that use the job hostnames from your site's aliases file. These URLs match your other job-generated URLs, so you don't need custom code to correct the hostname.
products:
  - Commerce
  - B2C Commerce
release: "264"
---
# Honor Job Hostnames in Image URL Generation

In a job context, such as a catalog export, B2C Commerce can generate image URLs that use the job hostnames from your site's aliases file. These URLs match your other job-generated URLs, so you don't need custom code to correct the hostname.

When B2C Commerce runs a job, such as a catalog export, there's no storefront request to determine the hostname. Instead, B2C Commerce relies on the job hostnames in your site's aliases file. Previously, when the following `MediaFile` Script API methods ran within a job context, they didn't apply the `job-hostnames` configuration from the aliases file. Instead, the methods fell back to the default instance hostname. As a result, image URLs in feeds and other job output sometimes used a different hostname than the pipeline URLs. To correct the hostname, merchants had to write custom code.

Now, jobs generate image URLs for using the same hostname as your other job-generated URLs.

![Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-cc-b2c_merchandiser_administrator-264-0-0-production-enus/ea76f372-6cfa-42a6-8e7c-05c6df7abed8/images/icon_example.png)

Example

Suppose that your storefront is `www.example.com`, and your aliases file defines that as the job hostname. You run a nightly catalog export job that generates a product feed, and each product includes an image URL.

- Without this behavior, the job can't determine which hostname to use, so it falls back to the default instance domain. Your feed goes out with image URLs like `https://prd.my.commercecloud.salesforce.com/.../shoe.jpg`.
- With this behavior turned on, the job uses the job hostname from your aliases file instead: `https://www.example.com/.../shoe.jpg`.

The image links now match your storefront's hostname, so external channels show your product images correctly. You no longer require custom code to replace the hostname.

This behavior applies to these `MediaFile` Script API methods when they run within a job context:

 
| Method | Description |
| --- | --- |
| `MediaFile.getImageURL()` | Generates a URL for the media file. |
| `MediaFile.getAbsImageURL()` | Generates an absolute URL for the media file. |
| `MediaFile.getHttpImageURL()` | Generates a standard HTTP URL for the media file. |
| `MediaFile.getHttpsImageURL()` | Generates a secure HTTPS URL for the media file. |

If you want this behavior for your environment, contact Salesforce Support.

![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-cc-b2c_merchandiser_administrator-264-0-0-production-enus/ea76f372-6cfa-42a6-8e7c-05c6df7abed8/images/icon_note.png)

Note Before you turn on this behavior, review any custom code that replaces hostnames in your job-generated image URLs. After you turn it on, these URLs use your configured job hostnames, so you no longer need that custom code.