Skip to content
This repository has been archived by the owner on Aug 13, 2024. It is now read-only.

issue when adding header parameter with ";" #215

Closed
eveslage opened this issue Mar 29, 2018 · 1 comment
Closed

issue when adding header parameter with ";" #215

eveslage opened this issue Mar 29, 2018 · 1 comment

Comments

@eveslage
Copy link

I found an issue when generating a nginx config with the option "add_header" and a ";" in the header content, like this snippet:

roles:
- role: jdauphant.nginx
  nginx_sites:
    site_name:
        - location / {
          add_header Content-Disposition 'attachment; filename="$basename"';
          }

it generates an incorrect site config file:

  location / {
       add_header Content-Disposition 'attachment; 
       filename="$basename"';
  }

the semicolon in the header content is replaced by a newline. nginx returns the newline also in the header parameter and the at least some browser cannot parse that correctly.

%curl -I "https://<URL>/file.exe"
HTTP/1.1 200 OK
Server: nginx/1.13.9
Date: Thu, 29 Mar 2018 09:24:56 GMT
Content-Type: application/octet-stream
Content-Length: 63261296
Connection: keep-alive
Last-Modified: Mon, 26 Mar 2018 14:08:46 GMT
Content-Disposition: attachment;
       filename="file.exe"
Accept-Ranges: bytes

the correct config file has to be

  location / {
       add_header Content-Disposition 'attachment; filename="$basename"';
  }

resulting in the correct header answer

%curl -I "https://<URL>/file.exe"
HTTP/1.1 200 OK
Server: nginx/1.13.9
Date: Thu, 29 Mar 2018 09:24:56 GMT
Content-Type: application/octet-stream
Content-Length: 63261296
Connection: keep-alive
Last-Modified: Mon, 26 Mar 2018 14:08:46 GMT
Content-Disposition: attachment; filename="file.exe"
Accept-Ranges: bytes

can you fix that? for now a use the ansible replace command to fix the incorrect config files using a regex.

@eveslage
Copy link
Author

eveslage commented Apr 4, 2018

sorry, I just saw the duplication with #135
close this issue here

@eveslage eveslage closed this as completed Apr 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant