Open david-crowder opened 9 years ago
Thanks for this report, David. After a quick look, I agree, that's the problem. Nope, not intended. Will investigate further.
Re-opening this issue. chef/omnibus-supermarket#48 was reverted after causing problems behind a load-balancer. There is new issue #1236 opened to refactor the nginx template to better handle the different SSL/non-SSL scenarios for Supermarket.
Revisiting this, I have tested changing the X-Forwarded-Proto
setting from https
to $http_x_forwarded_proto
in a few different SSL and non-SSL scenarios. There will be a PR incoming after some more testing, but I figured I would do a brain dump here on what can be done today with configuration and the tweak to the nginx site template.
Change X-Forwarded-Proto
setting from https
to $http_x_forwarded_proto
in /var/opt/supermarket/nginx/etc/sites-enabled/rails
.
Attribute settings:
protocol: http
nginx:
force_ssl: false
Attributes:
protocol: https
nginx:
force_ssl: true
ssl:
enabled: true
Attributes:
protocol: https
nginx:
force_ssl: false
ssl:
enabled: false
Attributes:
protocol: https
nginx:
force_ssl: true
ssl:
enabled: false
I'm planning two things to simplify the above:
X-Forwarded-Proto
setting from https
to $http_x_forwarded_proto
in the template within the omnibus packageprotocol
attribute altogether. It exists to set PROTOCOL
in the environment and that environment variable seems to be only used within the Rails app to build links back to itself with the scheme the end user should use. Rails already has mechanisms to figure that out based on X-Forwarded-Proto
, so use that and repetitive configuration and bugs around it go away.
I ran into an issue recently where despite having disabled ssl through setting
node['supermarket']['nginx']['force_ssl']
to false, navigating to the universe endpoint still presented https download links.I believe it is due to this line: https://github.com/chef/omnibus-supermarket/blob/master/cookbooks/omnibus-supermarket/templates/default/rails.nginx.conf.erb#L123
Causing https://github.com/chef/supermarket/blob/master/app/models/universe.rb#L132 to always use https.
Is this the intended behavior?