liip/drifter

Static file get delivered the same data, even when the content changes from host side

ChristianRiesen opened this issue · 0 comments

Reproduction Steps:

  1. Create drifter box with only the base, git and php-fpm roles (to install nginx)
  2. Put any file from host in the folder, ending in html, css or the likes and load it, to see content.
  3. Alter file on host, then reload file in browser.
  4. Although the file changed, the browser does not display the changed content (headers show a change, like etag etc)

Expected behavior:

File content should change.

Observed behavior:

The sendfile option in nginx sends the content of the file descriptior, which is the content when first accessed by nginx. When the file changes on the host, this does not seem to be refreshed. It only works if the file is changed from within (ssh) the actual box. Seems to be mainly an issue with Virtualbox as far as I saw it.

Drifter version: 1.5.0
Vagrant version: 2.0.0
OS and version: Windows 10 and Mac OSX (current as of 5.2.2018)

Additional information:

  • Problem started happening recently, didn't happen in an older version of Drifter: No
  • Problem can be reliably reproduced, doesn't happen randomly: Yes
  • Problem happens to my colleagues aswell: Yes

Potential fix
Setting the sendfile option from on to off in /etc/nginx/nginx.conf fixes it immediately. This role fixed it for me reliably:

- name: Apply nginx fix for sendfile
  become: yes
  lineinfile:
    dest: /etc/nginx/nginx.conf
    regexp: "sendfile on;$"
    line: "sendfile off;"
    owner: root
    group: root
  notify: restart nginx