Is there an easy way to have pow serve https? Is there an easy way to have pow serve https? ruby-on-rails ruby-on-rails

Is there an easy way to have pow serve https?


The easiest way I found was to use Tunnels: https://github.com/jugyo/tunnels

$ gem install tunnels$ rvmsudo tunnels   # or just use sudo if using rbenv

No configuration required.


Option 1: Complete Pow with Tunnelss

I've been having issue with the Tunnels solution, which is great but will be noticed as insecure by the browser, which will cause you headaches when playing with CORS for example.

I've tested the PowSSL solution (the one using Stud), but it was missing the HTTP_X_FORWARDED_PROTO, which will cause you another set of headaches when your app needs to know if it has been requested through HTTP or HTTPS (well, it will never know it was HTTPS).

But this later approach was great because it was generating a valid certificate for all the configured POW .dev domains!

So I built tunnelss which combines the two approaches: it's a fork of tunnels, and it adds certificate generation!

I hope you'll enjoy it, feel free to send pull requests if you want to complete it, it's just a fast hack working on MacOS X for now...

Option 2: Switch to Invoker (using my fork... for now)

Invoker is a great replacement to Pow since it natively includes HTTPS support. You won't have to add another solution on top of Pow to get HTTPS!

However, in comparison with Pow, I found it had 2 limitations:

  • you have to specify a command for each process so that in can run it,
  • you can't have a default rule, handling all requests to localhost and proxying them to a specific application.

These limitations were not difficult to overcome and I made a pull request with the 2 changes. Until it's accepted, you can install the forked version using this:

git clone https://github.com/rchampourlier/invoker invoker -b proxy-only-modecd invokergem build invoker.gemspecgem install invoker-1.5.0.gem

With this fork, you'll be able to use a global config, for example ~/.invoker.ini like this one:

[my-rails-app]port = 3000[my-sinatra-app]port = 9292[default]port = 9292

...and run Invoker as a proxy with this command:

invoker ~/.invoker.ini -d


Use stunnel to create a tunnel to the pow server.

Like:

stunnel3 -f -d 443 -r 127.0.0.1:80