lando / php

The Official Lando PHP plugin.
https://docs.lando.dev/php
GNU General Public License v3.0
14 stars 15 forks source link

Why should Lando enable MultiViews, which is disabled by Apache default? #66

Closed mochiya-hemmi closed 5 months ago

mochiya-hemmi commented 11 months ago

Why "Options Indexes FollowSymLinks MultiViews" ?

I built a Drupal site with Lando and created a page called /example, but I got an Apache 404 Not Found. This is because the "example.gitignore" file exists directly under the document root, and the MultiViews could not find the extension "gitignore". By the way, ".htaccess" does not have a description to enable MultiViews. After some research, I found that MultiViews was enabled in Apache's VirtualHost options.

https://github.com/lando/php/blob/77e0c6982878ad829fd55a5ea2d83a9f95eb6ffa/services/php/default-ssl.conf#L15 https://github.com/lando/php/blob/77e0c6982878ad829fd55a5ea2d83a9f95eb6ffa/services/php/default-ssl.conf#L51 https://github.com/lando/php/blob/77e0c6982878ad829fd55a5ea2d83a9f95eb6ffa/services/php/default.conf#L15

I looked at https://httpd.apache.org/docs/current/en/mod/core.html#Options to see what the Apache defaults are for this, but it seems that the only default value is Options FollowSymlinks.

I'm not sure why you needed to enable MultiViews, but at least it's hurting Drupal development.

I hope you can improve. thank you.

reynoldsalec commented 8 months ago

@pirog you know any reasons why this is in the default apache config for PHP?

I think Drupal does have some .htaccess rules to disable MultiViews under certain circumstances (like hardening access to files), and it looks like some other projects disable MultiViews for PHP CGI.

reynoldsalec commented 8 months ago

...looks like there's an older issue this duplicates: https://github.com/lando/lando/issues/3139

Also found another instance where having MultiViews enabled caused some confusion: https://github.com/lando/apache/issues/20

reynoldsalec commented 8 months ago

Doing further research on this, it sounds like the default Apache conf in Lando's PHP plugin is legacy from some default @pirog found a LONG time ago.

My research seems to indicate that most default confs either don't include MultiViews or disable it explicitly, as you expressed @mochiya-hemmi.

I think if we just drop MultiViews from the config, it'll be disabled by other config already in the PHP images. Created a PR to that effect and will test a bit.

pirog commented 8 months ago

@reynoldsalec it might make sense to find the version where this was changed and have two sets of config files for before and after it was changed

reynoldsalec commented 5 months ago

@mochiya-hemmi this should be resolved as of PHP v0.10.0, which will be available in Lando releases going forward. If you want to try installing the latest PHP version, you can manually install it using the "Docker" instructions: https://docs.lando.dev/php/#custom-installation