Non existent php file


(Jean-Luc Lacroix) #1

Related to:

When an non existent php file is requested, although a 404 is sent back to the requester, a Primary script unknown error is also thrown in the error log and the custom 404 file is also not served. That custom file is however correctly served for any other non-existent file with a extension different from .php

Config file:

example.com {
	fastcgi / /var/run/php/php7.0-fpm.sock php {
		index index.php login.php
	}

	errors /var/log/caddy/error.log {
		404  /var/www/err_img/404.html
	}
	index index.php
	root /var/www
}

(Matt Holt) #2

@abiosoft - What do you think, is this what we expect? I honestly haven’t used PHP in so long I can’t even remember. :slight_smile:


(Abiola Ibrahim) #3

That is not expected, I will dig more into this.


(Abiola Ibrahim) #4

The reason is that fastcgi server responds with a body and Caddy prioritises the upstream response over writing another response.

Maybe we should make it user configurable for Caddy to override fastcgi upstream response body when the response code is > 400.


(Matt Holt) #5

Thanks for looking into it!

That seems like a good idea. If I recall correctly, that is how it is done on other servers too.


(Magikstm) #6

Is this related to these?



(Abiola Ibrahim) #7

No, that is another issue. Not related.

By the way, thanks for bringing that up. I’ve forgotten about that pull request and it needs my review.


(system) #8

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.