# Authentication errors for requests through Apache HTTPS proxy

**URL:** <https://discourse.chef.io/t/authentication-errors-for-requests-through-apache-https-proxy/2745>\
**Category:** Chef Infra (archive)\
**Created:** [May 15, 2012, 8:52am UTC](https://discourse.chef.io/t/authentication-errors-for-requests-through-apache-https-proxy/2745 "2012-05-15T08:52:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Janne\_Liuhtonen](https://avatars.discourse-cdn.com/v4/letter/j/e47c2d/32.png) [@Janne\_Liuhtonen](https://discourse.chef.io/u/Janne_Liuhtonen)\
**Post date:** [May 15, 2012, 8:52am UTC](https://discourse.chef.io/t/authentication-errors-for-requests-through-apache-https-proxy/2745/1 "2012-05-15T08:52:55Z")

</div>

Hi,

I’m trying to proxy the connection to chef-server with Apache and  
mod\_proxy. The proxy seems to work, I get the Chef server API front  
page displayed correctly and for example “knife client list” works.  
Uploading new data or updating existing data however doesn’t work and  
I’m 403 errors. Example:

$ knife role from file roles/base.rb  
ERROR: You authenticated successfully to [https://my.chef.server.com](https://my.chef.server.com) as  
liuhtonen but you are not authorized for this action  
Response:

403 Forbidden
# Forbidden

You don't have permission to access /roles/base on this server.

or with verbose output:

$ knife role from file roles/base.rb -VV  
DEBUG: Using configuration from /home/liuhtonen/.chef/knife.rb  
DEBUG: Signing the request as liuhtonen  
DEBUG: Sending HTTP Request via PUT to [my.chef.server.com:443/roles/base](http://my.chef.server.com:443/roles/base)  
/usr/lib/ruby/1.8/net/http.rb:2105:in `error!': 403 "Forbidden" (Net::HTTPServerException) from /usr/lib/ruby/gems/1.8/gems/chef-0.10.8/lib/chef/rest.rb:245:in`api\_request’  
from /usr/lib/ruby/gems/1.8/gems/chef-0.10.8/lib/chef/rest.rb:296:in  
`retriable_rest_request' from /usr/lib/ruby/gems/1.8/gems/chef-0.10.8/lib/chef/rest.rb:226:in`api\_request’  
from /usr/lib/ruby/gems/1.8/gems/chef-0.10.8/lib/chef/rest.rb:130:in `put_rest' from /usr/lib/ruby/gems/1.8/gems/chef-0.10.8/lib/chef/role.rb:282:in`save’  
from /usr/lib/ruby/gems/1.8/gems/chef-0.10.8/lib/chef/knife/role\_from\_file.rb:41:in  
`run' from /usr/lib/ruby/gems/1.8/gems/chef-0.10.8/lib/chef/knife/role_from_file.rb:38:in`each’  
from /usr/lib/ruby/gems/1.8/gems/chef-0.10.8/lib/chef/knife/role\_from\_file.rb:38:in  
`run' from /usr/lib/ruby/gems/1.8/gems/chef-0.10.8/lib/chef/knife.rb:391:in`run\_with\_pretty\_exceptions’  
from /usr/lib/ruby/gems/1.8/gems/chef-0.10.8/lib/chef/knife.rb:166:in `run' from /usr/lib/ruby/gems/1.8/gems/chef-0.10.8/lib/chef/application/knife.rb:128:in`run’  
from /usr/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/knife:25  
from /usr/bin/knife:19:in `load’  
from /usr/bin/knife:19

Apache configuration:

\<VirtualHost \*:443\>  
ServerName [my.chef.server.com](http://my.chef.server.com)

DocumentRoot /usr/lib64/ruby/gems/1.8/gems/chef-server-api-0.10.8/public

SSLEngine on  
SSLCertificateFile /etc/certs/chef/chef-server.crt  
SSLCertificateKeyFile /etc/certs/chef/chef-server.key  
RequestHeader set X\_FORWARDED\_PROTO ‘https’

AllowEncodedSlashes on

RewriteEngine on  
RewriteCond %{DOCUMENT\_ROOT}/%{REQUEST\_FILENAME} !-f  
RewriteRule ^/(.\*)$ [http://127.0.0.1:4000/$1](http://127.0.0.1:4000/%241) [P]

ErrorLog logs/chef\_error\_log  
TransferLog logs/chef\_access\_log  
LogLevel info

Using chef server with port 4000 directly works without any problems.

Any clues what might cause this?

---

<div class="post-metadata">

**Author:** ![Vladimir\_Girnet](https://avatars.discourse-cdn.com/v4/letter/v/e19b73/32.png) [@Vladimir\_Girnet](https://discourse.chef.io/u/Vladimir_Girnet)\
**Post date:** [May 15, 2012, 9:10am UTC](https://discourse.chef.io/t/authentication-errors-for-requests-through-apache-https-proxy/2745/2 "2012-05-15T09:10:56Z")

</div>

I see a bit different rewrite rule in my configuration, may be this is the cause?

RewriteRule ^/(.\*)$ [http://127.0.0.1:4000](http://127.0.0.1:4000)%{REQUEST\_URI} [P,QSA,L]

On May 15, 2012, at 11:52 AM, Janne Liuhtonen wrote:

> Hi,
> 
> I'm trying to proxy the connection to chef-server with Apache and  
> mod\_proxy. The proxy seems to work, I get the Chef server API front  
> page displayed correctly and for example "knife client list" works.  
> Uploading new data or updating existing data however doesn't work and  
> I'm 403 errors. Example:
> 
> Apache configuration:
> 
> \<VirtualHost \*:443\>  
> ServerName [my.chef.server.com](http://my.chef.server.com)
> 
> DocumentRoot /usr/lib64/ruby/gems/1.8/gems/chef-server-api-0.10.8/public
> 
> SSLEngine on  
> SSLCertificateFile /etc/certs/chef/chef-server.crt  
> SSLCertificateKeyFile /etc/certs/chef/chef-server.key  
> RequestHeader set X\_FORWARDED\_PROTO 'https'
> 
> AllowEncodedSlashes on
> 
> RewriteEngine on  
> RewriteCond %{DOCUMENT\_ROOT}/%{REQUEST\_FILENAME} !-f  
> RewriteRule ^/(.\*)$ [http://127.0.0.1:4000/$1](http://127.0.0.1:4000/$1) [P]
> 
> ErrorLog logs/chef\_error\_log  
> TransferLog logs/chef\_access\_log  
> LogLevel info
> 
> Using chef server with port 4000 directly works without any problems.
> 
> Any clues what might cause this?

--  
Vladimir Girnet  
Infrastructure Engineer  
Tacit Knowledge

> **[Tacit Knowledge joins forces with Grid Dynamics - Tacit Knowledge](http://www.tacitknowledge.com)**
>
> In May 2021, we joined forces with Grid Dynamics, a digital-native technology services provider that accelerates growth for Forture 1000 companies.

---

<div class="post-metadata">

**Author:** ![realityforge](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/realityforge/32/395_2.png) [@realityforge](https://discourse.chef.io/u/realityforge)\
**Post date:** [May 16, 2012, 12:02am UTC](https://discourse.chef.io/t/authentication-errors-for-requests-through-apache-https-proxy/2745/3 "2012-05-16T00:02:07Z")

</div>

Hi,

We have a slightly different setup. This may or may not help. We  
actually proxy both the web and the API servers through the same  
apache instance.

HTH

* * *

ProxyRequests Off  
\<Proxy \*\>  
Order deny,allow  
Allow from all

RewriteEngine On

# Are we making an API request?

RewriteCond %{HTTP:X-Ops-Timestamp} .  
RewriteRule ^/(.\*) [http://localhost:4000/$1](http://localhost:4000/$1) [P,L]

# No, it's a WebUI request

## RewriteRule ^/(.\*) [http://localhost:4040/$1](http://localhost:4040/$1) [P,L]

On Tue, May 15, 2012 at 6:52 PM, Janne Liuhtonen  
[janne.liuhtonen@gmail.com](mailto:janne.liuhtonen@gmail.com) wrote:

> Hi,
> 
> I'm trying to proxy the connection to chef-server with Apache and  
> mod\_proxy. The proxy seems to work, I get the Chef server API front  
> page displayed correctly and for example "knife client list" works.  
> Uploading new data or updating existing data however doesn't work and  
> I'm 403 errors. Example:
> 
> $ knife role from file roles/base.rb  
> ERROR: You authenticated successfully to [https://my.chef.server.com](https://my.chef.server.com) as  
> liuhtonen but you are not authorized for this action  
> Response:
> 
> 403 Forbidden
> # Forbidden
> 
> You don't have permission to access /roles/base on this server.
> 
> or with verbose output:
> 
> $ knife role from file roles/base.rb -VV  
> DEBUG: Using configuration from /home/liuhtonen/.chef/knife.rb  
> DEBUG: Signing the request as liuhtonen  
> DEBUG: Sending HTTP Request via PUT to [my.chef.server.com:443/roles/base](http://my.chef.server.com:443/roles/base)  
> /usr/lib/ruby/1.8/net/http.rb:2105:in `error!': 403 "Forbidden" (Net::HTTPServerException) from /usr/lib/ruby/gems/1.8/gems/chef-0.10.8/lib/chef/rest.rb:245:in `api\_request'  
> from /usr/lib/ruby/gems/1.8/gems/chef-0.10.8/lib/chef/rest.rb:296:in  
> `retriable_rest_request' from /usr/lib/ruby/gems/1.8/gems/chef-0.10.8/lib/chef/rest.rb:226:in `api\_request'  
> from /usr/lib/ruby/gems/1.8/gems/chef-0.10.8/lib/chef/rest.rb:130:in `put_rest' from /usr/lib/ruby/gems/1.8/gems/chef-0.10.8/lib/chef/role.rb:282:in `save'  
> from /usr/lib/ruby/gems/1.8/gems/chef-0.10.8/lib/chef/knife/role\_from\_file.rb:41:in  
> `run' from /usr/lib/ruby/gems/1.8/gems/chef-0.10.8/lib/chef/knife/role_from_file.rb:38:in `each'  
> from /usr/lib/ruby/gems/1.8/gems/chef-0.10.8/lib/chef/knife/role\_from\_file.rb:38:in  
> `run' from /usr/lib/ruby/gems/1.8/gems/chef-0.10.8/lib/chef/knife.rb:391:in `run\_with\_pretty\_exceptions'  
> from /usr/lib/ruby/gems/1.8/gems/chef-0.10.8/lib/chef/knife.rb:166:in `run' from /usr/lib/ruby/gems/1.8/gems/chef-0.10.8/lib/chef/application/knife.rb:128:in `run'  
> from /usr/lib/ruby/gems/1.8/gems/chef-0.10.8/bin/knife:25  
> from /usr/bin/knife:19:in `load'  
> from /usr/bin/knife:19
> 
> Apache configuration:
> 
> \<VirtualHost \*:443\>  
> ServerName [my.chef.server.com](http://my.chef.server.com)
> 
> DocumentRoot /usr/lib64/ruby/gems/1.8/gems/chef-server-api-0.10.8/public
> 
> SSLEngine on  
> SSLCertificateFile /etc/certs/chef/chef-server.crt  
> SSLCertificateKeyFile /etc/certs/chef/chef-server.key  
> RequestHeader set X\_FORWARDED\_PROTO 'https'
> 
> AllowEncodedSlashes on
> 
> RewriteEngine on  
> RewriteCond %{DOCUMENT\_ROOT}/%{REQUEST\_FILENAME} !-f  
> RewriteRule ^/(.\*)$ [http://127.0.0.1:4000/$1](http://127.0.0.1:4000/$1) [P]
> 
> ErrorLog logs/chef\_error\_log  
> TransferLog logs/chef\_access\_log  
> LogLevel info
> 
> Using chef server with port 4000 directly works without any problems.
> 
> Any clues what might cause this?

--  
Cheers,

Peter Donald
