liip / liip/drifter

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

Open
#205 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: webservers role: nginx
Dominant language
HTML
Stars
57
Forks
25
PR merge metrics
No merged PRs in 30d

Description

**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
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect the nginx role or configuration that provisions /etc/nginx/nginx.conf, then reproduce the issue with a host-mounted HTML or CSS file under VirtualBox. Verify that changing the host file and reloading it serves the new content; the issue's proposed sendfile setting and nginx restart notification define the expected result.

Written by the indexing model from the issue text.

Assessment

Tech stack
ansible, nginx
Domain
devops, infrastructure
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.