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

Web-Server does not return symlinked assets #33089

Closed
a-r-m-i-n opened this issue Aug 9, 2019 · 5 comments
Closed

Web-Server does not return symlinked assets #33089

a-r-m-i-n opened this issue Aug 9, 2019 · 5 comments

Comments

@a-r-m-i-n
Copy link

Symfony version(s) affected: 4.3.3

Description / How to reproduce
I've created sym-links, pointing from public/js/... to assets/js/..., on Windows.

The local webserver returns code 200, when requesting an asset using the browser, but the contents are empty (length: 0).

This happens for files which are directly symlinked as well as files, which are inside a symlinked folder.

The symlinks has been created with symfony/filesystem's symlink() method (with admin privileges) and they work perfectly in Windows itself. Also, when I access a sym-linked file with php directly (file_get_contents('public/js/app.js')) I receive the contents of the origin file in PHP.

Just the web-server is not sending the assets' contents. Request:

GET /js/adminlte.min.js HTTP/1.1

Response:

HTTP/1.1 200 OK
Host: 127.0.0.1:8000
Date: Fri, 09 Aug 2019 11:06:42 GMT
Connection: close
Content-Type: application/javascript
Content-Length: 0

Thanks!

@xabbuh
Copy link
Member

xabbuh commented Aug 9, 2019

Do these request run through your Symfony application or could this just be a web server configuration issue (Apache for example has options to forbid following symlinks)?

@a-r-m-i-n
Copy link
Author

a-r-m-i-n commented Aug 11, 2019

@xabbuh I'm just using $ php bin/console server:run, which usually does not trigger Symfony when requesting an existing file, like styles.css or images, located in public/. Calling controller actions works like charm. Just requesting sym-linked assets, does not work. Copied assets work.

@a-r-m-i-n
Copy link
Author

Maybe this issue is a bug of php's web server itself.

@a-r-m-i-n
Copy link
Author

Yep. It is not an issue of Symfony's web-server. It's also occurring when using the server directly:

> php -S localhost:8000 -t .
PHP 7.2.19 Development Server started at Sun Aug 11 16:25:34 2019
Listening on http://localhost:8000
Document root is C:\Dev\test
Press Ctrl-C to quit.
[Sun Aug 11 16:25:39 2019] ::1:60634 [200]: /images/test/test.png

This test.png was a symlink to ../real_image.png. It doesn't matter if the file is located within Document root. If it's a symlink it is not working at all.

This could be an issue for PHP itself.

@a-r-m-i-n
Copy link
Author

Created a bug-report on php.net: https://bugs.php.net/bug.php?id=78400

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