Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

commit #4ac4000 breaks existing lighttpd configuration #910

Closed
dgsiegel opened this issue Apr 8, 2017 · 7 comments
Closed

commit #4ac4000 breaks existing lighttpd configuration #910

dgsiegel opened this issue Apr 8, 2017 · 7 comments
Milestone

Comments

@dgsiegel
Copy link

dgsiegel commented Apr 8, 2017

as with commit #4ac4000, js and css files are loaded with a query string and the suggested lighttpd configuration will stop working. the issue is that the lighttpd rewrite engine will look at the full url with the querystring (e.g. /all.js?v=1234..) and therefore the regex pattern

"^/(.*.(js|ico|gif|jpg|png|css|asc|txt|eot|woff|ttf|svg))$" => "/public/$1",

will stop working. an easy fix would be to add the querystring after the regex, however i think using url.rewrite-if-not-file would be a better solution.

"^/(.*.(js|ico|gif|jpg|png|css|asc|txt|eot|woff|woff2|ttf|svg))(\?.*)?$" => "/public/$1",

@jtojnar
Copy link
Member

jtojnar commented Apr 8, 2017

Maybe even better would be removing these complex rewrite rules and just using src="public/all.js" in the client.

@jtojnar jtojnar added the bug label Apr 8, 2017
@jtojnar jtojnar added this to the 2.18 milestone Apr 8, 2017
@jtojnar
Copy link
Member

jtojnar commented Apr 9, 2017

@niol what do you think about simplifying the rewrites?

@niol
Copy link
Collaborator

niol commented Apr 9, 2017

The point of query string cache busting is to avoid having bug reports because of the use of outdated js. I think this is important and also handy for upgrades and development.

If simplifying rewrite rules for lighttpd is wanted (no problem with apache), there is the previous implementation I proposed (using files with a timestamp in their name).

@jtojnar
Copy link
Member

jtojnar commented Apr 9, 2017

I was actually talking about dropping the rewrite rules altogether and using the real path ($root/public/app.js) in the script/link[rel=stylesheet] tags. That should fix this problem and also simplify the installation – I remember someone wanting to install selfoss on Hiawatha web server and citing rewrite rules as an obstacle.

@niol
Copy link
Collaborator

niol commented Apr 9, 2017

Yes, great, no objection to that. Also moving generated assets to public/gen or data/gen would avoid giving too much permissions to the user running php.

@jtojnar
Copy link
Member

jtojnar commented Apr 9, 2017

@dgsiegel Since I do not know url.rewrite-if-not-file, I have updated the wiki page to use the improved regex, for now. I also updated the upgrade instructions. Additionally, if you can provide an example of url.rewrite-if-not-file, I will be thankful if you edit the wiki.

@niol I wrote down some ideas in #913, please try to check if I missed something.

P.S. I will also be available on the gitter chat.

@jtojnar jtojnar removed the bug label Apr 9, 2017
@dgsiegel
Copy link
Author

@jtojnar url.rewrite-if-not-file is similar to Apache´s "!-f" RewriteRule and unfortunately only works with actual, existing files. as most files are in the /public directory but being referred as / this approach won't work with the current state.

jtojnar added a commit that referenced this issue May 6, 2017
Pull request #907 switched to using query string as a cache busting
strategy but the runner for the PHP built-in server did not anticipate
any text after file name extension.

See also: #910
@jtojnar jtojnar closed this as completed May 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants