[wp-trac] [WordPress Trac] #60143: Running behind HAProxy with fcgi makes WordPress think URL rewriting is unavailable

WordPress Trac noreply at wordpress.org
Fri Dec 22 21:10:19 UTC 2023


#60143: Running behind HAProxy with fcgi makes WordPress think URL rewriting is
unavailable
--------------------------+-----------------------------
 Reporter:  nebulon42     |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Permalinks    |    Version:  6.4.2
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 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`.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/60143>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list