Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
710 views
in Technique[技术] by (71.8m points)

caching - Server is serving old versions of static files, but trimmed or padded to match length of new versions

The symptoms of my problem match this question pretty much exactly: Changed static files are cropped/padded to the new size and served the old - Fedora

Whenever I make changes to my static files (e.g. .js and .css), those changes don't show up in the served file. However, if my changes cause the file to change length, then the served file does match the new length:

  • If I delete characters from anywhere in the static file, then the served file is trimmed at the end by that many characters.
  • If I add characters to anywhere in the static file, then the served file is padded with that many ? (that's U+FFFD) characters at the end.

The reason the linked answer doesn't solve my problem is that I'm not using Apache. I'm writing a Python web app for Heroku, so I'm using gunicorn and Flask (and therefore Werkzeug). The linked answer says that disabling sendfile in Apache solved the problem, so I tried setting the 'USE_X_SENDFILE' variable to False, as per this page, but it didn't help. I also set 'SEND_FILE_MAX_AGE_DEFAULT' to 1 in a further attempt to prevent some sort of caching from happening, and that didn't help either.

If it's not obvious, I really don't know much at all about configuring web servers, so having run out relevant Google hits, I'm at a loss as to what might be causing this. Help?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Virtualbox hates sendfile. If you turn it off it should work.

For example in nginx you would need to add sendfile: off;. In Apache it's just EnableSendfile off.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...