[erlang-questions] Static files served through Webmachine

Tristan Sloughter tristan.sloughter@REDACTED
Tue Jul 19 04:53:51 CEST 2011


Yeah, I do things like that already with an nginx proxy in front of
Webmachine.

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
representation of the user. Obviously I do that simply in Webmachine. But
I'm not even sure if thats possible to filter out and proxy with nginx this
way or f it is just a stupid thing to do or not.

Thanks,
Tristan

On Mon, Jul 18, 2011 at 9:39 PM, Jack Moffitt <jack@REDACTED> wrote:

> > Can anyone think of a way I can keep the nice URLs and serve the static
> html
> > files through nginx or another webserver.
>
> The typical solution to this is to reverse proxy webmachine under
> nginx. You can set pattern matches in Nginx which will forward dynamic
> traffic to webmachine running on a different port (invisibly to the
> client) and serve static content in all its optimized nginx glory.
>
> Here's something from my own setup which forward /reset and /forgot to
> webmachine:
>
>        location /forgot {
>                proxy_pass http://127.0.0.1:8191
>        }
>
>        location /reset {
>                proxy_pass http://127.0.0.1:8191;
>        }
>
> This will cause /reset to go to http://127.0.0.1:8191/reset.
> Webmachine runs on port 8191.
>
> jack.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110718/783da238/attachment.htm>


More information about the erlang-questions mailing list