Opened 12 months ago
#60143 new defect (bug)
Running behind HAProxy with fcgi makes WordPress think URL rewriting is unavailable
Reported by: | nebulon42 | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 6.4.2 |
Component: | Permalinks | Keywords: | |
Focuses: | Cc: |
Description
I have WordPress set up behind HAProxy which directly uses fcgi for PHP and nginX for static files. HAProxy sends $_SERVER['SERVER_SOFTWARE'] = 'HAProxy 2.3.20-1ppa1~focal'
. As a result in Settings > Permalinks I'm having index.php
prefixes for permalinks. If I do not change permalink settings rewriting works just fine but as soon as I make changes I'm set for index.php
in the permalinks as then the rewrite rules are updated.
WordPress here incorrectly infers that URL rewriting might be unavailable. If I trick WordPress into believing I'm running on nginX by making HAProxy sending $_SERVER['SERVER_SOFTWARE'] = 'nginx'
rewriting works fine and the index.php
prefix for permalinks is gone.
This might be resolved by adding a condition for HAProxy in got_url_rewrite()
and defining a is_haproxy
global similar to the one for nginX which then checks if the SERVER_SOFTWARE
contains HAProxy
.