https-portal icon indicating copy to clipboard operation
https-portal copied to clipboard

Trim whitespace in ERB templates

Open jose1711 opened this issue 2 years ago • 0 comments

ERB supports space trimming (https://www.puppet.com/docs/puppet/5.5/lang_template_erb.html):

You can trim whitespace surrounding a non-printing tag by adding hyphens (-) to the tag delimiters. <%- — If the tag is indented, trim the indentation. -%> — If the tag ends a line, trim the following line break.

and using them will make nginx configs look better. This is the current situation:

server {
    listen 443 ssl http2;
    
    server_name example.com;

    ssl_certificate /var/lib/https-portal/example.com/production/chained.crt;
    ssl_certificate_key /var/lib/https-portal/example.com/production/domain.key;

    ssl_session_cache shared:SSL:50m;
    ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:E
CDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256;
    ssl_prefer_server_ciphers on;

    ssl_dhparam /var/lib/https-portal/dhparam.pem;

    # Send HSTS header if configured
    

    

    

    

    

    
    location / {
        
        proxy_pass http://example:80;
        
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;

        
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
        proxy_read_timeout 2h;
        
    }
    
}

jose1711 avatar Jun 02 '23 12:06 jose1711