Hey @janpio!
Welcome to the Community
Also great timing. I actually just built a little system yesterday that uses a redirect just like that to fall HTML requests back to a function What I found is that when you’re using a 302 redirect to the function (which causes the function url to flash in the browser address since the browser redirects and calls the function itself), the behavior works like you think. When you use a 200 (‘rewrite’), I’m not sure why, but I don’t think the splat injection to the query string works quite the same… but you do have the initial request path available instead. I ended up just using
/* /.netlify/functions/my-function 200
and inside the function, referencing event.path
for the /image-name
. That’s worked great for me!
My _redirects
and function - both part of an open source project called That’s at…
Hope that helps!
–
Jon