Title: haproxy problem accessing wp-admin
Last modified: December 4, 2025

---

# haproxy problem accessing wp-admin

 *  Resolved [cshabazian](https://wordpress.org/support/users/cshabazian/)
 * (@cshabazian)
 * [4 months ago](https://wordpress.org/support/topic/haproxy-problem-accessing-wp-admin/)
 * I am using an external IP address via _[ redundant link deleted ]_ which directs
   traffic to a server I’m running haproxy on. This works just fine to access the
   wordpress site landing page (main page) via public URL FQDN (Example: `https://
   wp.mywordpress.com`), but any other pages it redirects it to the site/home URL
   which is the internal IP address of the site (Example: `http://192.168.1.1`).
   This works fine for me on my home network of course, but I cannot access anything
   via the public URL. If I change the site/home URL to the external FQDN, then 
   it stops working. There is obviously a setting I need somewhere in WordPress,
   but I’ve tried using a rewrite with .htaccess, setting the home/site URL to the
   external address, and it doesn’t work.
   Help or pointers would be very much appreciated!
   My haproxy setup is very simple:`########################## FRONTENDS ##########################
   frontend webservers    bind :80    bind *:443  ssl crt /etc/letsencrypt/live/
   mywordpress.com/fullcert.pem    redirect scheme https code 301 if !{ ssl_fc }
   mode http# wp.mywordpress.comacl host_wp.mywordpress.com hdr(host) -i wp.mywordpress.
   comuse_backend wp.mywordpress.com if host_wp.mywordpress.com##########################
   BACKENDS ############################ wp.mywordpress.combackend wp.mywordpress.
   comserver wp.mywordpress.com 192.168.1.1:80 check(NOTE: The SSL termination on
   the haproxy works just fine. I get a secure connection, and the certificate is
   properly used)
    -  This topic was modified 4 months ago by [bcworkz](https://wordpress.org/support/users/bcworkz/).
      Reason: formatting fixed
    -  This topic was modified 4 months ago by [Jan Dembowski](https://wordpress.org/support/users/jdembowski/).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fhaproxy-problem-accessing-wp-admin%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [davidjason](https://wordpress.org/support/users/davidjason/)
 * (@davidjason)
 * [4 months ago](https://wordpress.org/support/topic/haproxy-problem-accessing-wp-admin/#post-18741803)
 * Hi there,
 * The issue is likely that WordPress needs to recognize the correct URL in wp-options.
   Try these:
    1. Go to wp-config.php and add:
       define(‘WP_HOME’, ‘[https://wp.mywordpress.com&#8217](https://wp.mywordpress.com&#8217););
       define(‘WP_SITEURL’, ‘[https://wp.mywordpress.com&#8217](https://wp.mywordpress.com&#8217););
    2. Or via database: Update wp_options table:
       siteurl = [https://wp.mywordpress.com](https://wp.mywordpress.com)
       home = [https://wp.mywordpress.com](https://wp.mywordpress.com)
    3. Make sure haproxy is forwarding the Host header correctly. Add to haproxy:
       reqadd
       X-Forwarded-Proto: httpsreqadd X-Forwarded-Host: wp.mywordpress.com
 * This tells WordPress the external URL when accessed through the proxy. Give these
   a try!
 *  Thread Starter [cshabazian](https://wordpress.org/support/users/cshabazian/)
 * (@cshabazian)
 * [4 months ago](https://wordpress.org/support/topic/haproxy-problem-accessing-wp-admin/#post-18741831)
 * Thanks for the advice. I changed the backend to:
 *     ```wp-block-code
       backend wp.mywordpress.comhttp-request add-header X-Forwarded-Proto httpshttp-request add-header X-Forwarded-Host: wp.mywordpress.comserver wp.mywordpress.com 192.168.1.1:80 check
       ```
   
 * And configured the site/home url to [https://wp.mywordpress.com](https://wp.mywordpress.com)
   but I’m getting too many redirects:
   =====================================
 * This page isn’t working
 * **wp.mywordpress.com** redirected you too many times.
 * =====================================
 * FYI, it DOES now work properly for other links. Example, I click on an entry,
   and it takes me to it instead of the internal IP address page, so it just seems
   to be a problem with wp-admin now
    -  This reply was modified 4 months ago by [cshabazian](https://wordpress.org/support/users/cshabazian/).
    -  This reply was modified 4 months ago by [cshabazian](https://wordpress.org/support/users/cshabazian/).
    -  This reply was modified 4 months ago by [cshabazian](https://wordpress.org/support/users/cshabazian/).
    -  This reply was modified 4 months ago by [cshabazian](https://wordpress.org/support/users/cshabazian/).
 *  Thread Starter [cshabazian](https://wordpress.org/support/users/cshabazian/)
 * (@cshabazian)
 * [4 months ago](https://wordpress.org/support/topic/haproxy-problem-accessing-wp-admin/#post-18743194)
 * Just to be clear (because I received a moderator message telling me to post in
   the correct forum), I am using SELF HOSTED WordPress.org. I assume I got that
   email because of the “representative URL” I have above. I will change it from.
   com to .org in future posts to clarify.
    -  This reply was modified 4 months ago by [cshabazian](https://wordpress.org/support/users/cshabazian/).
 *  Thread Starter [cshabazian](https://wordpress.org/support/users/cshabazian/)
 * (@cshabazian)
 * [4 months ago](https://wordpress.org/support/topic/haproxy-problem-accessing-wp-admin/#post-18743272)
 * Ok, so for anyone who runs across this in the future, the problem was due to 
   the fact that I am terminating SSL on the proxy, and my backend is on port 80.
   The fix is to add the following (I put it before Database settings, but you should
   be able to put it anywhere)
 *     ```wp-block-code
       // ** This is because the front end is https and the back end is http ** //$_SERVER['HTTPS'] = 'on';
       ```
   

Viewing 4 replies - 1 through 4 (of 4 total)

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fhaproxy-problem-accessing-wp-admin%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 3 participants
 * Last reply from: [cshabazian](https://wordpress.org/support/users/cshabazian/)
 * Last activity: [4 months ago](https://wordpress.org/support/topic/haproxy-problem-accessing-wp-admin/#post-18743272)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
