using nginx rewrite rules with sinatra
Martin DeMello <[email protected]> Tue, 24 Sep 2019 13:47:20 -0700
| Newsgroups | gmane.comp.lang.ruby.general |
|---|---|
| Message-ID | <CAFrFfuFGU0XbXZSfZBZybL8KibucmjE7mEmGnN-QYWcja=c5dQ@mail.gmail.com> |
I've been having a hard time implementing the following pattern: 1. Have a sinatra app that thinks it's hosted under / - for example GET /input -> display a form POST /process -> process the form and in form.html <form action="process" ...> 2. Expose it at host:port (currently with puma, though I'm happy to change that if some other server makes it easier), and put it behind nginx with a prefix, e.g. myapp, so that the actual urls are /myapp/input and /myapp/process which rewrite to host:port/input and host:port/process I have not been able to get the sinatra app to be entirely independent of the myapp prefix and the puma port - I keep running into glitches where the form posts to the wrong place, or the request hits sinatra with /myapp still in the url so that the matching fails. Does anyone have a working example of doing this that I can copy^take inspiration from? martin Unsubscribe: <mailto:[email protected]?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>