Fastcgi header_upstream support (maybe feature request)

WordPress doesnt recognize Caddy, so I would like to simulate fastcgi as nginx, which should be by changing a Server header to nginx value.

I would expect the something like header_upstream Server nginx for proxy configuration to work with fastcgi.

Something like this

:2015 {
	fastcgi / 127.0.0.1:9000 php {
		header_upstream Server "nginx/caddy"
	}
}

I didn’t think HTTP headers existed in the context of a FastCGI proxy, or that WordPress “recognises” any web server via FastCGI…

The closest analogue available to you would be setting an environmental variable with env, but I can’t imagine how it would help with whatever issue you’re having.

Im not sure either. But echo $_SERVER['SERVER_SOFTWARE']; does really output Caddy/0.10.7 - so Caddy must somehow modify the headers.

PHP documentation mentions the source of that constant is from the headers. http://php.net/manual/en/reserved.variables.server.php

Those are set here, as environmental variables:

https://github.com/mholt/caddy/blob/bc56793d3b919b17080deaa427bb5f70a826f4d6/caddyhttp/fastcgi/fastcgi.go#L269-L295

You should be able to use env to override or set additional variables, which happens here, shortly after the above:

https://github.com/mholt/caddy/blob/bc56793d3b919b17080deaa427bb5f70a826f4d6/caddyhttp/fastcgi/fastcgi.go#L309-L313

Are you able to elaborate on how this would fix your issue with Caddy/WordPress?

2 Likes

Thank you, this solved my issue :slight_smile:

:2015 {
	fastcgi / 127.0.0.1:9000 php {
		env SERVER_SOFTWARE "nginx/caddy"
	}
}
1 Like

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