Yeah, I do things like that already with an nginx proxy in front of Webmachine. <div><br></div><div>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.<div>
<br></div><div>Thanks,</div><div>Tristan <br><br><div class="gmail_quote">On Mon, Jul 18, 2011 at 9:39 PM, Jack Moffitt <span dir="ltr"><<a href="mailto:jack@metajack.im">jack@metajack.im</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">> Can anyone think of a way I can keep the nice URLs and serve the static html<br>
> files through nginx or another webserver.<br>
<br>
</div>The typical solution to this is to reverse proxy webmachine under<br>
nginx. You can set pattern matches in Nginx which will forward dynamic<br>
traffic to webmachine running on a different port (invisibly to the<br>
client) and serve static content in all its optimized nginx glory.<br>
<br>
Here's something from my own setup which forward /reset and /forgot to<br>
webmachine:<br>
<br>
        location /forgot {<br>
                proxy_pass <a href="http://127.0.0.1:8191" target="_blank">http://127.0.0.1:8191</a><br>
        }<br>
<br>
        location /reset {<br>
                proxy_pass <a href="http://127.0.0.1:8191" target="_blank">http://127.0.0.1:8191</a>;<br>
        }<br>
<br>
This will cause /reset to go to <a href="http://127.0.0.1:8191/reset" target="_blank">http://127.0.0.1:8191/reset</a>.<br>
Webmachine runs on port 8191.<br>
<font color="#888888"><br>
jack.<br>
</font></blockquote></div><br></div></div>