Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot create a location reference without a www_root, proxy, location_alias, fastcgi, stub_status, or location_custom_cfg #446

Closed
inhumantsar opened this issue Sep 15, 2014 · 2 comments

Comments

@inhumantsar
Copy link

Cannot create a location reference without a www_root, proxy, location_alias, fastcgi, stub_status, or location_custom_cfg

I'm getting this error despite passing the proxy param. This is what I'm using:

class { 'nginx' :
    worker_processes    => $nginx_worker_processes,
    worker_connections  => $nginx_worker_connections,
    nginx_error_log     => $nginx_error_log,
    pid                 => $nginx_pid_file,
    keepalive_timeout   => $nginx_keepalive_timeout,
    http_access_log     => $nginx_http_access_log,
    http_cfg_append     => [ "log_format main $nginx_log_format", "default_type $nginx_default_type", ]
}

nginx::resource::upstream { 'terminator-proxy' :
    ensure  => present,
    members => $nginx_upstream_servers,
}

nginx::resource::vhost { 'terminator-app' :
    listen_port => $nginx_vhost_listen_port,
}

nginx::resource::location { 'terminator-app-root' :
    vhost               => 'terminator-app',
    location            => '/',
    proxy               => 'http://terminator-proxy',
    proxy_set_header    => $nginx_proxy_set_header,
}

I've confirmed that all the params coming into this class are set properly. I threw fail() commands into nginx::resources::location at the beginning, at the if $proxy != undef check and just before the 'Cannot create a location reference without a www_root...' check as well. All of them show proxy as having the correct value.

fail("(precheck) proxy: $proxy; vhost: $vhost; loc: $location; headers: $proxy_set_headers")
if (($www_root == undef) and ($proxy == undef) and ($location_alias == undef) and ($stub_status == undef) and ($fastcgi == undef) and ($location_custom_cfg == undef)) {
    fail("(check failed) proxy: $proxy; vhost: $vhost; loc: $location; headers: $proxy_set_headers")
    fail('Cannot create a location reference without a www_root, proxy, location_alias, fastcgi, stub_status, or location_custom_cfg defined')
}

Precheck comes back with the correct values. However, when I comment out the precheck fail(), the check failed one comes back with undef proxy and proxy_set_headers.

I've tried this with the latest from Git as well as the 0.0.10 from Puppet Forge to the same effect. I will admit that I'm running Ruby 1.8.7, is that perhaps the issue? I would be happy to write the fix but this sudden undef thing has me up against a brick wall. If someone can point me in the right direction, it would be much appreciated. Thanks!

@3flex
Copy link
Contributor

3flex commented Sep 16, 2014

On the vhost resource set use_default_location to false. If not, a default location is created for the vhost, but it will be created without a valid configuration if you haven't set www_root, proxy, fastcgi, or location_custom_cfg configuration on the vhost as well.

Created #447 to address this.

@inhumantsar
Copy link
Author

That did the trick! Thanks 👍

@3flex 3flex closed this as completed Sep 16, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants