netlify / netlify/petsofnetlify

This is adorable and I love it but also I don't think the 404 handling for local/netlify dev images works

Open
#48 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Nunjucks
Stars
46
Forks
32
PR merge metrics
No merged PRs in 30d

Description

This is extremely NOT urgent please do not go out of your way to answer this.

I was playing around with this after I found it via CSS-Tricks and your tweet https://twitter.com/philhawksworth/status/1328340868726726656 about using Cloudinary and Netlify redirects, but with a 404 handler to re-serve local images as mentioned here https://twitter.com/philhawksworth/status/1328350104340848641.

But I'm not sure if it's working these days?

Reproduce

  1. Pull down this codebase
  2. npm install
  3. Add a new pet to pets.json along with a new image to src/images
  4. Run netlify dev

The new image 404s:

Screen Shot 2021-05-14 at 4 59 40 PM

I thought perhaps the netlify.toml needed to also account for the :height parameter in the requests, eg

[[redirects]]
  from = "/cloudinaried/:height/*"
  to = "/images/:splat"
  status = 404

But that didn't seem to work either.

Accessing the image directly when netlify dev is running at http://localhost:8888/images/the-new-doggo.jpg works as expected.

Has the syntax changed since this was originally written?

The idea of having 404s at Cloudinary fall back to the local, untransformed image is very appealing for local development and working with deploy previews, so I'm curious if I'm missing something here.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with netlify.toml and the image request path produced by the local site. Run the reported setup with netlify dev, using a new entry in pets.json and an image in src/images, then compare the failing transformed request with the working direct image URL. Done means local or deploy-preview image requests fall back to the untransformed local image without breaking existing image handling.

Written by the indexing model from the issue text.

Assessment

Domain
devops, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.