0

I hope that's a good place to ask as there are several layers of software and can't tell which one is an issue here.

My browserync proxy is returning me some cached version of my website, here is my workflow:

On top of windows 10, I'm running VMWare instance of Fedora 25 and this is my "base" OS since now.

As the second VMWare instance I'm running Ubuntu 16.04.2 Server and this server is mounted with SSHFS inside my Fedora linux. I do SSH into it with user with root privileges (but not root itself).

I'm running flask application inside virtualenv, inside /var/www, I did chown user:www-data -R for this folder.

My Nginx is serving this application at port 80 on ubuntu server, and it's resolving it by a hostname (website.com), so on my fedora workstation I have host "192.168.xx.xx website.com" this means I can access my application when I type website.com, all good since now.

Problem starts when I dropped in gulp and browsersync-gulp plugin.

I'm proxying my app with these settings:

proxy: {
    target: 'http://127.0.0.1',
    proxyReq: [
        function(proxyReq) {
            proxyReq.setHeader('Host', 'website.com')
        }
    ]
}

And that works fine, it opens another server under 192.168.xx.xx and refreshes itself when I submit some changes in files (as I specified watch task to reload browsersync under any changes).

Problem I'm facing is, everytime I refresh a website either by browsersync proxy or by www.website.com, I'm receiving different version of my website (I can see some past changes I've done recently) - Looks like it keeps 3 different version of my website in cache and it's serving me one of them completely randomly.

I guess, that number of 3 versions reflects 3 workers I've set for gunicorn inside systemd, it looks like this:

"ExecStart=/home/user/.local/bin/gunicorn --workers 3 --bind unix:website.com.sock -m 777 wsgi:app"

(I'm aware permissions should be 007)

And that's how my Nginx site config looks like:

location / {
    include proxy_params;
    proxy_pass http://unix:/var/www/website.com/website.com.sock;
}

So the chains looks like this:

Fedora 25 -> SSH -> Ubuntu 16.04.2 -> Gulp -> Gulp-browsersync -> Nginx -> VirtualEnv -> Gunicorn -> Flask app

Something like that

TLDR; for some reason every time I refresh random version of my website

Please let me know how I can fix that problem, any other tips to my workflow also appreciated, thank you.

0

In the end this is not real "caching" issue. Gunicorn instance should be restarted every time there are some changes in frontend files. Closing this for now.

If you are using systemd for serving your application, this needs to be restarted every time change has been made, otherwise I'd serve old version of website.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.