I have setup nginx['enable_non_ssl']=true
in the /etc/opscode/chef-server.rb
file and run chef-server-ctl reconfigure
but I still get a redirect when I try to curl the http port for chef which kind of defeats the purpose of this setting. See errors below.
My chef-server.rb
file:
cat /etc/opscode/chef-server.rb
nginx['enable_non_ssl']=true
nginx['non_ssl_port']=80
Running reconfigure:
chef-server-ctl reconfigure
Starting Chef Client, version 12.0.3
resolving cookbooks for run list: ["private-chef::default"]
[2015-05-25T13:12:26+00:00] WARN: Cookbook 'local-mode-cache' is empty or entirely chefignored at /opt/opscode/embedded/cookbooks/local-mode-cache
[2015-05-25T13:12:26+00:00] WARN: Cookbook 'local-mode-cache' is empty or entirely chefignored at /opt/opscode/embedded/cookbooks/local-mode-cache
[2015-05-25T13:12:26+00:00] WARN: Cookbook 'local-mode-cache' is empty or entirely chefignored at /opt/opscode/embedded/cookbooks/local-mode-cache
....
Curl command showing that I still get redirected:
<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>openresty/1.7.10.1</center>
</body>
</html>
How do I get a working chef-server up?
The change in the chef-server.rb file made the url as http but when I logged in prompted again for https login means; user login is twice once in http and once in https.
let me know if you had a chance to try this and any success in the configuration as HTTP Instance Thanks in advance.
I got the same issue an fixed it
I got the same issue with a rencent install of Chef Server (
chef-manage v2.4.4
)What we want
After installed my chef server instance on a dedicated server, it did works correctly with SSL.
But our production servers are deployed on dedicated host in a private VLAN, and users acces to the services or web apps through a nginx web server running as a reverse proxy.
So to put the chef server in production mode, I had to configure my reverse proxy to proxy the requests:
Here the correct request/response route pattern:
Request:
Response:
The normal issue
But, like you, the chef server default configuration force the SSL redirection from the reverse proxy to the chef host in the vlan. It causes an infinite redirection loop:
The normal fix
So we have to disable the SSL chef.vlan side.
The normal method is to edit the file
/opt/obscode.chef-server.rb
(and create it if it doesn't exist), by inserting the following directive:and optionally (because this is already the default value) the following one:
Thus we would just had to reconfigure the chef server:
But there is a bug in chef-server
But there is a bug in the chef template recipe that it used to generate the nginx confi file. Thus the previous directives are ignored when we reconfigure the chef server.
So the infinite loop stays there.
Also, you can see these other resources:
Fixing the issue
To fix this situation, I had to adapt the proposed solution from the bug ticket.
Find the nginx config files on the chef host
The last one is embedded nginx conf file. It contains the following bloc code, source of the issue:
Find the nginx config recipes that sources the embedded nginx config
The third is the template generating the embedded nginx config:
Fix the recipe
We had to fix it addind the following lines:
node.default['private_chef']['nginx']['enable_non_ssl']=true
We should append it to the following block:
So the final block code looks like:
:
Apply the changes
Finally we must regenerate the nginx config file from the recipe template by reconfiguring the chef server:
Then the route pattern works as expected.
Enjoy!
So, I investigated the issue and found next:
Except Nginx the WebUI chef-manage uses Unicorn web-server and the App has property config.force_ssl=true unless ENV['NO_SSL'].
So for disabling SSL you need pass env variable
export NO_SSL=true
to run command or run-script of the WebUI.Relevant settings from Chef:
So according to the above I believe you will need to edit/create the
chef-server.rb
file in the/etc/opscode/
directory, then runchef-server-ctl reconfigure
.