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_header for location #729

Closed
apazga opened this issue Dec 15, 2015 · 3 comments
Closed

add_header for location #729

apazga opened this issue Dec 15, 2015 · 3 comments

Comments

@apazga
Copy link

apazga commented Dec 15, 2015

Hi,

There is no possibility to use add_header inside a location, right? I tried e.g. the following from hiera:

nginx::nginx_locations:
  'myhostname-alias':
    location: '^~ /wp-content'
    vhost: 'myhostname'
    location_alias: '/var/www/myhostname/wp-content'
    add_header:
      'Access-Control-Allow-Origin': '*'

But it gives the following error:

Error 400 on SERVER: Evaluation Error: Error while evaluating a Resource Statement, Nginx::Resource::Location[myhostname-alias]: has no parameter named 'add_header' on node myhostname.mydomain.com

Do you know any other possibility to do this? Or is not supported by now?
Thanks in advance

@tux-o-matic
Copy link

@apazga place it under 'location_cfg_append' which expects a hash of custom parameters.
So your example:

nginx::nginx_locations:
  'myhostname-alias':
    location: '^~ /wp-content'
    vhost: 'myhostname'
    location_alias: '/var/www/myhostname/wp-content'
    location_cfg_append:
      add_header: 'Access-Control-Allow-Origin *'

@apazga
Copy link
Author

apazga commented Dec 18, 2015

It worked like a charm.
Thanks so much!

@apazga apazga closed this as completed Dec 18, 2015
@ammartaj53
Copy link

how can I add multiple add_header for same location?

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