Putting cloudfront in front of Thumbor
atsbob
HOBBYOP

2 months ago

I'd like to set up an Thumbor to transform images and then put cloudfront on top of it with a custom subdomain

So it would be thumborapp.up.railway.app > dxxxx.cloudfront.net > img.site.com

Is it a simple case of creating a new distribution and setting the thumborapp.up.railway.app URL as the origin? I'm not using S3 to store original files (only to keep copies of the transformations). So Thumbor will refer to my origin host for new transformations, and will redirect traffic to S3 for already generated images once the edge does not have the file in storage.

When I tried to reference the transformed URL with Cloudfront (i.e. https://dxxxx.cloudfront.net/xxx/image.jpg), I got a 404. I know it's hitting Railway but I'm not sure why it's giving a 404 yet the image transform and displays correctly if I do it via the original Railway URL

HTTP/1.1 404 Not Found Content-Type: application/json Content-Length: 101 Connection: keep-alive Server: railway-edge X-Railway-Edge: railway/us-east4-eqdc4a X-Railway-Fallback: true X-Railway-Request-Id: Rlhc9CNUQo-YCdB3woOzXw Date: Fri, 12 Dec 2025 20:45:56 GMT X-Cache: Error from cloudfront Via: 1.1 50adcd6749b8cd1a89ce54c8bb0b335a.cloudfront.net (CloudFront) X-Amz-Cf-Pop: MIA50-P2 X-Amz-Cf-Id: bl5d8wYr31gVykGa6flgdWOi-UYzS-RDzfOLE2NBiDMcyy1eOfIJyQ==

Solved$10 Bounty

2 Replies

atsbob
HOBBYOP

2 months ago


Alright updated to suit. Disregard that it says "internal". I put the wrong origin initially but updated that. Still getting 404s

curl -I https://d19xskfyoont8t.cloudfront.net/Iy9HGxjUfC9bCpeZjq1aTJ1WCrs=/800x533/smart/filters:quality(85):format(auto)/https://cdn.pixabay.com/photo/2017/06/15/19/35/coffee-2406439_960_720.jpg

HTTP/1.1 404 Not Found

Content-Type: application/json

Content-Length: 101

Connection: keep-alive

Server: railway-edge

X-Railway-Edge: railway/us-east4-eqdc4a

X-Railway-Fallback: true

X-Railway-Request-Id: oc26MCxaSHysTShsPvyhXg

Date: Mon, 15 Dec 2025 00:54:08 GMT

X-Cache: Error from cloudfront

Via: 1.1 2acee962813570d561b79ba0949c58c4.cloudfront.net (CloudFront)

X-Amz-Cf-Pop: MIA3-P1

X-Amz-Cf-Id: NS6eeTgz1GdBfxN_qlmLpQipRe8NCqK9hY__lWlEZT3-unYrCBKfCQ==

but it's fine here


atsbob
HOBBYOP

2 months ago

Omg that simple. I hadn't completed the step the last time because I saw I needed to configure a CNAME record and thought I was doing something wrong. Now it works. Thank you!


Status changed to Solved brody 2 months ago


Loading...