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

Gzip values aren't passed incorrectly to nginx server #718

Closed
GosthMan opened this issue Nov 14, 2015 · 6 comments
Closed

Gzip values aren't passed incorrectly to nginx server #718

GosthMan opened this issue Nov 14, 2015 · 6 comments

Comments

@GosthMan
Copy link

GosthMan commented Nov 14, 2015

Hello
I am trying to enable the gzip compresion on some of my nginx server but the conf isn't written correctly.

---- # host.yaml
nginx::config::http_cfg_append:  
  gzip: on  
  gzip_proxied: any  
  gzip_vary: on  
  gzip_types:  
    - text/css
    - text/plain
    - text/xml
    - text/js
    - text/javascript
    - application/xml
    - application/javascript
    - application/x-javascript
    - application/xml+rss
    - text/javascript
    - application/json
    - text/x-json
    - image/x-icon   
  gzip_comp_level: 5
# nginx.conf
  gzip             true;
  gzip_comp_level  5;
  gzip_proxied     any;
  gzip_types       text/css;
  gzip_types       text/plain;
  gzip_types       text/xml;
  gzip_types       text/js;
  gzip_types       text/javascript;
  gzip_types       application/xml;
  gzip_types       application/javascript;
  gzip_types       application/x-javascript;
  gzip_types       application/xml+rss;
  gzip_types       text/javascript;
  gzip_types       application/json;
  gzip_types       text/x-json;
  gzip_types       image/x-icon;
  gzip_vary        true;

What do i have to do in order that nginx.conf receive the correct values

Thank you

@tarcinil
Copy link

I am using the following hiera array and it is working as expected on the master branch.

nginx::config::gzip_types:
  - 'text/plain'
  - 'text/css'
  - 'application/json'
  - 'application/x-javascript'
  - 'text/xml'
  - 'application/xml'
  - 'application/xml+rss'
  - 'text/javascript'
  - 'application/javascript'

What branch are you working on?

@GosthMan
Copy link
Author

GosthMan commented Nov 30, 2015

Hello,
The module is set as mod "jfryman/nginx" on Puppetfile so i presume is the master branch too
The types has no issue, are set as expected, the problem is when is setting gzip and gzip_vary.
Those 2 values should be set as on in the config but puppet sets them as true, also it doesn't take in count the already existent value of gzip on it returns duplicated gzip directive
This is my yaml section and from this all work except gzip: on and gzip_vary: on that on the server appear as gzip true and gzip_vary true

nginx::config::client_max_body_size: '32m'
nginx::config::http_cfg_append:
  real_ip_header: 'X-Forwarded-For'
  set_real_ip_from: '0.0.0.0/0'
  gzip: on
  gzip_proxied: any
  gzip_vary: on
  gzip_types: 
    - text/css
    - text/plain
    - text/xml
    - text/js
    - text/javascript
    - text/x-component
    - text/x-json
    - text/x-js
    - text/richtext
    - text/xsd
    - text/xsl
    - application/xml
    - application/javascript
    - application/x-javascript
    - application/xml+rss
    - application/json
    - image/x-icon
    - image/svg+xml
  gzip_comp_level: 5
  log_format:
    - graylog2_format '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$http_x_forwarded_for" <msec=$msec|connection=$connection|connection_requests=$connection_requests|millis=$request_time>'

@tarcinil
Copy link

r10k will not use the master branch. It will use the versions listed in the Forge, so a release is needed to get the gzip details as the 0.2.7 version doesn't contain the things that are needed.

I had to change my Puppetfile to the following as a workaround:

mod "nginx",
  :git => "[email protected]:jfryman/puppet-nginx.git",
  :ref => 'master'

@GosthMan
Copy link
Author

I have updated the module to use the github but no change in that
Here is what puppet agent -t -noop returns

@@ -44,28 +53,28 @@
   proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
   proxy_headers_hash_bucket_size 64;

-  gzip             on;
+  gzip             true;
   gzip_comp_level  5;
   gzip_proxied     any;
-  gzip_types     text/css;
-  gzip_types     text/plain;
-  gzip_types     text/xml;
-  gzip_types     text/js;
-  gzip_types     text/javascript;
-  gzip_types     text/x-component;
-  gzip_types     text/x-json;
-  gzip_types     text/x-js;
-  gzip_types     text/richtext;
-  gzip_types     text/xsd;
-  gzip_types     text/xsl;
-  gzip_types     application/xml;
-  gzip_types     application/javascript;
-  gzip_types     application/x-javascript;
-  gzip_types     application/xml+rss;
-  gzip_types     application/json;
-  gzip_types     image/x-icon;
-  gzip_types     image/svg+xml;
-  gzip_vary        on;
+  gzip_types       text/css;
+  gzip_types       text/plain;
+  gzip_types       text/xml;
+  gzip_types       text/js;
+  gzip_types       text/javascript;
+  gzip_types       text/x-component;
+  gzip_types       text/x-json;
+  gzip_types       text/x-js;
+  gzip_types       text/richtext;
+  gzip_types       text/xsd;
+  gzip_types       text/xsl;
+  gzip_types       application/xml;
+  gzip_types       application/javascript;
+  gzip_types       application/x-javascript;
+  gzip_types       application/xml+rss;
+  gzip_types       application/json;
+  gzip_types       image/x-icon;
+  gzip_types       image/svg+xml;
+  gzip_vary        true;

As you can see it still changes from on to true and that isn't ok
Any other ideas ?

@3flex
Copy link
Contributor

3flex commented Aug 30, 2016

@GosthMan you should be using the existing nginx::config::xxx parameters to configure gzip, there should be no need to use nginx::config::http_cfg_append for that purpose.

The available parameters in nginx::config are:

  • gzip
  • gzip_buffers
  • gzip_comp_level
  • gzip_disable
  • gzip_min_length
  • gzip_http_version
  • gzip_proxied
  • gzip_types
  • gzip_vary

@dhoppe
Copy link
Member

dhoppe commented Sep 17, 2016

I agree with @3flex and close this issue.

@dhoppe dhoppe closed this as completed Sep 17, 2016
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

4 participants