404 for asset routes with PHP dev server (v2.2 beta) #605
Comments
I would assume that your |
I do think the The dev server is an extremely useful tool for developing and works flawlessly even with big frameworks like Laravel. It should definitely be supported by Kirby, too, if you ask me. |
And you are using the newest version of the htaccess? It changed quite a bit recently. |
I attached a screenshot with the file open. I suppose mzur also uses the newest version of the .htaccess file. (That's what I meant by "the .htaccess is not the problem"). Maybe some functionality is deactivated on OS X by default in the httpd.conf? And this is required for the routes or something? |
The As @mzur wrote, the PHP server completely ignores |
Yep. Apparently the dev server handles all URIs with a dot as a static file request. While one could argue why it's necessary to use routes for panel assets like |
Hm, that's very strange. This "bug"/"intended behavior" basically means that users won't be able to use the PHP server for the Panel, only for the core. |
That's fucked up!! I will try to fix it :( |
Ok, I think I fixed all related issues. I'm not 100% happy with it, but dots in filenames are now replaced with a dash. I.e.:
I think this is the best compromise between readability and functionality. I also moved the fake assets (plugins.css and plugins.js) to different routes to fix this as well. Could you please give it a last try and see if you run into any additional issues? |
Ah, I also fixed the woff2 error by actually adding woff2 files facepalm :) |
But what happens with files that contain more than one dot? Or with files that contain dashes? |
You are too smart :) The additional dashes are no problem, but the dots could be. I will check that. |
The assets and the edit page are now loading correctly 👍 |
In the meantime I found a cool way to get around the dots issue in filenames. There's a unicode character called "one dot leader": ․ It looks like a dot, but is no dot. Whenever PHP detects the built-in cli server it will now replace dots in filenames with that unicode character. The cool part about it is that it's unique enough to be able to encode and decode it again that way. For the user the result is invisible and additionally rawurlencode will pick it up and encode it correctly for the URL which is another plus. I made some tests and it works great. It's also just a tiny unobtrusive "hack" that affects the cli server. I like it :) I hope you like it too. |
BTW that one dot leader thingy does actually never land on the filesystem in filenames. It only appears in URLs. |
So it will encode to |
Oh, that's awesome! |
When I'm running the Panel v2.2 locally on the PHP dev server (
php -S
) I get a 404 for some asset routes:These are not the actual files but routes like these that should return the files. I assume the dev server doesn't handle these routes correctly and looks for the actual files. Can anybody reproduce this issue?
The text was updated successfully, but these errors were encountered: