To start with, this sounds more like a bug then anything else.
My rails application is served by Unicorn. Then, using Nginx as a reverse proxy, I serve the application to the outside world using SSL.
So far so good, no problem. I'm using relative paths (Restful path helpers), so there should be no problem to produce this (for https://www.example.com):
new_entry_path => https://www.example.com/entries/new
This works fine in most cases.
The problem however appears when in a controller I try to redirect to a "show" action (using resources), let's say after a successful update (suppose Entry with id 100):
redirect_to @entry, flash: {success: "Entry has been updated"}
or
redirect_to entry_path(@entry), flash: {success: "Entry has been updated"}
they both produce a redirect to:
http://www.example.com/entries/100 # missing 's' in https...
instead of
/entries/100 # implying https://www.example.com/entries/100
As far as I've noticed, this only happens with show
action and only in controller redirects.
I'm bypassing this by doing something horrible and disgusting:
redirect_to entry_url(@entry).sub(/^http\:/,"https:"), flash: {success: "Entry has been updated"}
Has anyone ever confronted something similar? Any ideas will be gratefully accepted...