Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Incompatibility with FallbackResource and SetHandler

Abierto
#1,576 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
38/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
apache, docker, php
Área
devops

Línea de trabajo

Comienza con 8.4/bookworm/apache/Dockerfile alrededor de las líneas 97-99 y con el docker-php.conf generado que contiene la regla FilesMatch SetHandler. Reproduce el comportamiento informado de FallbackResource para URLs .php existentes y faltantes, y después evalúa las configuraciones de handler propuestas. Se considera terminado cuando los archivos PHP siguen usando el handler de PHP, mientras que las URLs .php faltantes llegan a FallbackResource sin un 404.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

I've just encountered an issue whereby our FallbackResource is applied correctly, except where the URL requested ends in .php.

For example:

  • http://localhost/example.html => Uses FallbackResource
  • http://localhost/example.php => Does not use FallbackResource and results in a 404

It seems that it's because the docker-php.conf configuration file sets the PHP Handler for any file which matches .php, and therefore the FallbackResource (handler) is not applied.

<FilesMatch \.php$>
	SetHandler application/x-httpd-php
</FilesMatch>

https://github.com/docker-library/php/blob/master/8.4/bookworm/apache/Dockerfile#L97-L99

This has been raised (and rejected) in the Apache Bugzilla:
https://bz.apache.org/bugzilla/show_bug.cgi?id=52403#c7

There seems to be a few possible solutions:

  1. Use AddType instead of AddHandler or SetHandler. I'm not sure if this is suggestion on the bz issue is from the Apache team, or is an observeration. I'm not sure whether this is a viable option
  2. Wrap the SetHandler call in a conditional
  3. Switch to mod_rewrite (not generally recommended now that FallbackResource exists)

Re 2, the change would be something like this:

<FilesMatch \.php$>
    <If "-f %{REQUEST_FILENAME}">
        SetHandler application/x-httpd-php
    </If>
</FilesMatch>

(Suggestion found here: https://stackoverflow.com/questions/50439963/apache-fallbackresource-configuration)
This would likely have a performance impact, but I would imagine no worse than using mod_rewrite.

I've tested the conditional SetHandler locally and it works as expected.

Lenguaje dominante
Dockerfile
Estrellas
4k
Forks
2k
Merge medio
18 h 8 min
PR fusionados (30 d)
2

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de docker-library/php

Todos los issues de docker-library/php

Issues similares

Más issues de DevOps

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.