[erlang-questions] Static files served through Webmachine

Jack Moffitt jack@REDACTED
Tue Jul 19 05:06:56 CEST 2011


> But my problem is wanting to be able have nice URLs like /user/user_id that
> if its a request for text/html returns a file from /priv/user/show.html
> while if its a request for application/json it returns the json

Ah, I see the issue. I assume show.html is mostly empty and loads data
from the json file? I'm not sure if nginx's matchers are sophisticated
enough to route by content requested. You could return a 302 from
webmachine, but this is probably going to make it less efficient than
just dumping the file from memory.

If you're willing to use the Rails-type .json/.html format stuff on
the ends of your URLs, this becomes easy.

Now you've made me curious whether web caching servers are smart
enough to distinguish by content type as well.

jack.



More information about the erlang-questions mailing list