#CI/CI failed to load img

3 messages · Page 1 of 1 (latest)

modern storm
#

I tried to build on a CI on gitlab but the remote images return an 403. I can perfectly acces the images from the url but not on CI

atomic frostBOT
#

Hi @modern storm. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Based on the information provided in the knowledge sources, it appears that your issue with remote images failing to load during CI/CD on GitLab might be related to image authorization in Astro. Here's what you need to know:

Astro requires you to authorize remote image domains or URL patterns for image optimization. This is an extra layer of security when displaying images from external sources. If you haven't configured this, it could explain why the images are accessible via URL but not during the CI process.

To resolve this issue, you need to configure authorized domains or URL patterns in your Astro configuration. Here's how you can do it:

  1. Open your astro.config.mjs file.
  2. Add the image.domains or image.remotePatterns configuration to authorize the domains of your remote images.

For example, to authorize images from a specific domain:

export default defineConfig({
  image: {
    domains: ["example.com"],
  },
});

Or to authorize images from HTTPS hosts:

export default defineConfig({
  image: {
    remotePatterns: [{ protocol: "https" }],
  },
});

Make sure to replace "example.com" with the actual domain of your remote images.

By adding this configuration, you should be able to authorize the remote images for optimization during the CI/CD process.

For more detailed information on authorizing remote images, you can refer to the Astro documentation on authorizing remote images.

If this doesn't solve your issue, you may need to investigate further into your CI/CD configuration or network settings to ensure that the CI environment has proper access to the remote image URLs.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: