#CI/CI failed to load img
3 messages · Page 1 of 1 (latest)
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:
- Open your
astro.config.mjsfile. - Add the
image.domainsorimage.remotePatternsconfiguration 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.