agschwender/pilbox — pull request #9 by ysimonson (2014-01-15 21:55:43+00:00)
Title: Allow for implicit hosts

This adds a config for "implicit hosts", which get appended to the request URL when no host is explicitly defined. If no implicit host is defined, then it operates the same as before.

This is valuable because it's sometimes difficult or cumbersome to provide the explicit URL relative to pilbox. For example, I have a webapp that has a bunch of images that may be resized via pilbox. When I run it locally, I reference the images as hostname-relative, as I may access the webapp either via localhost, or through a VM for stuff like IE testing.

To fix this without the implicit hosts feature, I'd have to augment my webapp to provide absolute image URLs that take into account the request host. This adds complexity and only works if you're determining the image URL at request time. Because we figure out some of the image URLs via background jobs, this isn't even an option for us.

Alternatively, I could just set the implicit host to localhost. Because the images will always be fetched by pilbox via localhost, this works fine - I don't have to add any code to my webapp, and I can continue to create images outside of request time.