# Error: Image optimization for URL '...' failed because the protocol is not allowed. Only 'https:' is supported.

- **ID:** `nextjs/invalid-image-optimization-url-protocol`
- **Domain:** nextjs
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 88%

## Root Cause

The next/image component or Image API is trying to optimize an image with an http:// URL, but Next.js only allows https:// URLs by default for security reasons.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| next@13.5.0 | active | — | — |
| next@14.0.0 | active | — | — |
| next@14.2.12 | active | — | — |

## Workarounds

1. **Add the dangerousAllowingHttp option to next.config.js to allow http:// URLs. Use with caution.** (90% success)
   ```
   Add the dangerousAllowingHttp option to next.config.js to allow http:// URLs. Use with caution.
   ```
2. **If you control the image source, migrate to https:// using a CDN or SSL certificate.** (95% success)
   ```
   If you control the image source, migrate to https:// using a CDN or SSL certificate.
   ```
3. **Use a proxy or rewrite in next.config.js to serve http images through an https endpoint.** (80% success)
   ```
   Use a proxy or rewrite in next.config.js to serve http images through an https endpoint.
   ```

## Dead Ends

- **** — If the image server does not support https, the image will not load. (80% fail)
- **** — This removes all optimization benefits and may increase page load times. (70% fail)
- **** — The protocol check is separate from the hostname check; you need to explicitly allow http. (85% fail)
