• Resolved eliesemoule

    (@eliesemoule)


    Hi,

    I installed haproxy front-end in front of my nginx server hosting wordpress and I can’t access the administration page. HAProxy is in charge of SSL.
    I added these lines in the file wp-config.php

    define('FORCE_SSL_ADMIN', true);
    define('FORCE_SSL_LOGIN', true);
    if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
      $_SERVER['HTTPS']='on';
    }

    Here is my HAProxy configuration

    frontend www-http
        bind *:80
        option forwardfor
        option http-server-close
        reqadd X-Forwarded-Proto:\ http
    
        acl host_mysite hdr(host) -i mysite
        acl path-content-admin path /wp-admin
        redirect scheme https if host_mysite path-content-admin
        use_backend mysite-backend if host_mysite
    
    frontend www-https
        bind *:443 ssl crt /etc/haproxy/certs/mysite.pem
        option forwardfor
        option http-server-close
        http-request set-header X-SSL %[ssl_fc]
        reqadd X-Forwarded-Proto:\ https
    
        acl host_mysite hdr(host) -i mysite
        use_backend mysite-backend if host_mysite
    
    backend mysite-backend
        redirect scheme https code 301 if !{ ssl_fc }
        server mysite xxx.xxx.xxx.xxx:80 send-proxy check

    Someone can help me, please

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    We’re sorry no one has been able to help you so far. Unfortunately, a proxy over nginx is a bit unusual with few of us having any experience with it. I don’t have such experience either. I’m primarily writing to see if you were able to resolve this through other resources. If you were, it’d be great if you could tell us here how you resolved this.

    In case this is still an issue, here’s a few thoughts about something to try. Ensure your siteurl and home options include https:// protocol. Look at and edit the options table items with phpMyAdmin or similar, if you cannot access the normal settings screen.

    Use your browser’s network developer tool to see what requests and redirects are made. Maybe something there will be a clue to what’s going wrong.

    Is there any way to trace proxy and/or nginx processing? If so, some good clues could be found. I know that in Apache, a trace level can be specified, which controls how much detail is logged in the processing of .htaccess rules. This can be very helpful if available.

    Thread Starter eliesemoule

    (@eliesemoule)

    Thank you. I solved my problem. I had to add the following lines in the Nginx configuration :

        location /wp-admin/ {
            index index.php
            try_files $uri $uri /index.php?$args;
        }
    Moderator bcworkz

    (@bcworkz)

    Awesome! Thanks for posting your solution.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Access wp-admin page behind haproxy’ is closed to new replies.