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

Add rewrite with if clause to puppet #279

Closed
hallemel opened this issue Mar 20, 2014 · 2 comments
Closed

Add rewrite with if clause to puppet #279

hallemel opened this issue Mar 20, 2014 · 2 comments

Comments

@hallemel
Copy link

Hi,
I need to add this rewrite lines into puppet
if '($remote_addr = !10.10.10.){
rewrite ^(/(admin|hmc|cmscockpit)/)(.
) /maintenance/404.html
}

With following lines I can add in puppet the rewrites to the vhost file.
But I can't check the ip range I need.
location_cfg_append => {
'rewrite' => '^(/(admin|hmc|cmscockpit)/)(.*) /maintenance/404.html
},

Has anyone an Idea how I can add this lines in puppet for rewrite?

@saz
Copy link
Sponsor Contributor

saz commented Jun 1, 2014

location_cfg_append => {
  'if ($remote_addr = !10.10.10.)' => "{ rewrite ^(/(admin|hmc|cmscockpit)/)(.) /maintenance/404.html; }\n set $dummy dummy",
},

The set $dummy dummy part is to prevent nginx show an error for the trailing semicolon.

@3flex
Copy link
Contributor

3flex commented Apr 10, 2015

I'm closing this for now as there are methods to add this code to the manifest. PRs are welcome to introduce cleaner support for if directives.

@3flex 3flex closed this as completed Apr 10, 2015
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

3 participants