HAProxy & WordPress in subdirectory — login into wp-admin redirects to rootHaProxy + IIS pages gradually get slowerHaProxy - Http and SSL pass through confighaproxy forward uri to root of another serverHaproxy logging not workserver timeout and retry in HAProxy 502HA-Proxy 301 re-direct: https to https://wwwHaProxy giving - 503 Service Unavailableopenldap with haproxy - (ldap_result() failed: Can't contact LDAP server)HAProxy does not perform SNI lookup
Did significant numbers of Japanese officers escape prosecution during the Tokyo Trials?
What is the use case for non-breathable waterproof pants?
Determine direction of mass transfer
How can I tell if a breaker uses both phases/legs
Are PMR446 walkie-talkies legal in Switzerland?
Storing voxels for a voxel Engine in C++
Testing using real data of the customer
Quantum corrections to geometry
Merge pdfs sequentially
Why did Drogon spare this character?
Python script to extract text from PDF with images
EU rights when flight delayed so much that return is missed
Why did other houses not demand this?
How do you earn the reader's trust?
What did Brienne write about Jaime?
The disk image is 497GB smaller than the target device
Why A=2 and B=1 in the call signs for Spirit and Opportunity?
Why does the painters tape have to be blue?
How to escape dependency hell?
What is to the west of Westeros?
Paired t-test means that the variances of the 2 samples are the same?
Why'd a rational buyer offer to buy with no conditions precedent?
Is there an idiom that means that you are in a very strong negotiation position in a negotiation?
Count all vowels in string
HAProxy & WordPress in subdirectory — login into wp-admin redirects to root
HaProxy + IIS pages gradually get slowerHaProxy - Http and SSL pass through confighaproxy forward uri to root of another serverHaproxy logging not workserver timeout and retry in HAProxy 502HA-Proxy 301 re-direct: https to https://wwwHaProxy giving - 503 Service Unavailableopenldap with haproxy - (ldap_result() failed: Can't contact LDAP server)HAProxy does not perform SNI lookup
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have two VPS running. One is running HAProxy and another one is running WordPress. Both VPS has private networking enabled and I can curl
the WordPress site fine from HAProxy server using its private IP address.
Here is URL settings for my WordPress site:
The HAProxy is doing SSL termination in this case because I'm planning to install more WordPress sites later with the following URLs:
- my-website.com/blog (WordPress #1)
- my-website.com/foo (WordPress #2)
- my-website.com/bar (WordPress #3)
Here is my config for HAProxy.
global
# default global config goes here
maxconn 2048
tune.ssl.default-dh-param 2048
defaults
log global
mode http
option forwardfor
option http-server-close
option httplog
option dontlognull
timeout connect 5000
timeout client 50000
timeout server 50000
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http
stats enable
stats uri /stats
stats realm Haproxy Statistics
stats auth xxx:xxx
frontend my-wordpress-frontend
bind *:443 ssl crt /etc/ssl/private/my-website.com.pem
option http-server-close
http-request set-header X-Forwarded-Proto https if ssl_fc
acl blog path_beg /blog
acl wpadmin path_beg /wp-
acl blog_search query -m reg ^s=.*$
acl blog_preview query -m reg ^p=.*$
acl root path /
redirect location https://my-website.com/blog/ if root
use_backend my-wordpress-backend if blog OR blog wpadmin OR blog blog_search OR blog blog_preview
default_backend my-wordpress-backend
backend my-wordpress-backend
redirect scheme https if ! ssl_fc
reqrep ^([^ :]*) /blog/(.*) 1 /2
reqrep ^([^ :]*) /blog/wp-admin/(.*) 1 /2
cookie SERVERID insert indirect nocache
server www-1 private_ip_address:80 check cookie
Everything looks fine except one thing. I'm able to see the login page at https://my-website.com/blog/wp-login.php
. But, after I login, it redirects me to https://my-website.com/wp-admin
.
This is not what I want. I was expecting to get https://my-website.com/blog/wp-admin
.
I added this to my wp-config.php but it didn't help:
// Start custom config ---
define( 'FORCE_SSL_ADMIN', true );
define('FORCE_SSL_LOGIN', true);
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
$_SERVER['HTTPS']='on';
// End custom config ---
/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';
Did I miss something here? What is wrong here?
haproxy wordpress
add a comment |
I have two VPS running. One is running HAProxy and another one is running WordPress. Both VPS has private networking enabled and I can curl
the WordPress site fine from HAProxy server using its private IP address.
Here is URL settings for my WordPress site:
The HAProxy is doing SSL termination in this case because I'm planning to install more WordPress sites later with the following URLs:
- my-website.com/blog (WordPress #1)
- my-website.com/foo (WordPress #2)
- my-website.com/bar (WordPress #3)
Here is my config for HAProxy.
global
# default global config goes here
maxconn 2048
tune.ssl.default-dh-param 2048
defaults
log global
mode http
option forwardfor
option http-server-close
option httplog
option dontlognull
timeout connect 5000
timeout client 50000
timeout server 50000
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http
stats enable
stats uri /stats
stats realm Haproxy Statistics
stats auth xxx:xxx
frontend my-wordpress-frontend
bind *:443 ssl crt /etc/ssl/private/my-website.com.pem
option http-server-close
http-request set-header X-Forwarded-Proto https if ssl_fc
acl blog path_beg /blog
acl wpadmin path_beg /wp-
acl blog_search query -m reg ^s=.*$
acl blog_preview query -m reg ^p=.*$
acl root path /
redirect location https://my-website.com/blog/ if root
use_backend my-wordpress-backend if blog OR blog wpadmin OR blog blog_search OR blog blog_preview
default_backend my-wordpress-backend
backend my-wordpress-backend
redirect scheme https if ! ssl_fc
reqrep ^([^ :]*) /blog/(.*) 1 /2
reqrep ^([^ :]*) /blog/wp-admin/(.*) 1 /2
cookie SERVERID insert indirect nocache
server www-1 private_ip_address:80 check cookie
Everything looks fine except one thing. I'm able to see the login page at https://my-website.com/blog/wp-login.php
. But, after I login, it redirects me to https://my-website.com/wp-admin
.
This is not what I want. I was expecting to get https://my-website.com/blog/wp-admin
.
I added this to my wp-config.php but it didn't help:
// Start custom config ---
define( 'FORCE_SSL_ADMIN', true );
define('FORCE_SSL_LOGIN', true);
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
$_SERVER['HTTPS']='on';
// End custom config ---
/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';
Did I miss something here? What is wrong here?
haproxy wordpress
add a comment |
I have two VPS running. One is running HAProxy and another one is running WordPress. Both VPS has private networking enabled and I can curl
the WordPress site fine from HAProxy server using its private IP address.
Here is URL settings for my WordPress site:
The HAProxy is doing SSL termination in this case because I'm planning to install more WordPress sites later with the following URLs:
- my-website.com/blog (WordPress #1)
- my-website.com/foo (WordPress #2)
- my-website.com/bar (WordPress #3)
Here is my config for HAProxy.
global
# default global config goes here
maxconn 2048
tune.ssl.default-dh-param 2048
defaults
log global
mode http
option forwardfor
option http-server-close
option httplog
option dontlognull
timeout connect 5000
timeout client 50000
timeout server 50000
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http
stats enable
stats uri /stats
stats realm Haproxy Statistics
stats auth xxx:xxx
frontend my-wordpress-frontend
bind *:443 ssl crt /etc/ssl/private/my-website.com.pem
option http-server-close
http-request set-header X-Forwarded-Proto https if ssl_fc
acl blog path_beg /blog
acl wpadmin path_beg /wp-
acl blog_search query -m reg ^s=.*$
acl blog_preview query -m reg ^p=.*$
acl root path /
redirect location https://my-website.com/blog/ if root
use_backend my-wordpress-backend if blog OR blog wpadmin OR blog blog_search OR blog blog_preview
default_backend my-wordpress-backend
backend my-wordpress-backend
redirect scheme https if ! ssl_fc
reqrep ^([^ :]*) /blog/(.*) 1 /2
reqrep ^([^ :]*) /blog/wp-admin/(.*) 1 /2
cookie SERVERID insert indirect nocache
server www-1 private_ip_address:80 check cookie
Everything looks fine except one thing. I'm able to see the login page at https://my-website.com/blog/wp-login.php
. But, after I login, it redirects me to https://my-website.com/wp-admin
.
This is not what I want. I was expecting to get https://my-website.com/blog/wp-admin
.
I added this to my wp-config.php but it didn't help:
// Start custom config ---
define( 'FORCE_SSL_ADMIN', true );
define('FORCE_SSL_LOGIN', true);
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
$_SERVER['HTTPS']='on';
// End custom config ---
/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';
Did I miss something here? What is wrong here?
haproxy wordpress
I have two VPS running. One is running HAProxy and another one is running WordPress. Both VPS has private networking enabled and I can curl
the WordPress site fine from HAProxy server using its private IP address.
Here is URL settings for my WordPress site:
The HAProxy is doing SSL termination in this case because I'm planning to install more WordPress sites later with the following URLs:
- my-website.com/blog (WordPress #1)
- my-website.com/foo (WordPress #2)
- my-website.com/bar (WordPress #3)
Here is my config for HAProxy.
global
# default global config goes here
maxconn 2048
tune.ssl.default-dh-param 2048
defaults
log global
mode http
option forwardfor
option http-server-close
option httplog
option dontlognull
timeout connect 5000
timeout client 50000
timeout server 50000
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http
stats enable
stats uri /stats
stats realm Haproxy Statistics
stats auth xxx:xxx
frontend my-wordpress-frontend
bind *:443 ssl crt /etc/ssl/private/my-website.com.pem
option http-server-close
http-request set-header X-Forwarded-Proto https if ssl_fc
acl blog path_beg /blog
acl wpadmin path_beg /wp-
acl blog_search query -m reg ^s=.*$
acl blog_preview query -m reg ^p=.*$
acl root path /
redirect location https://my-website.com/blog/ if root
use_backend my-wordpress-backend if blog OR blog wpadmin OR blog blog_search OR blog blog_preview
default_backend my-wordpress-backend
backend my-wordpress-backend
redirect scheme https if ! ssl_fc
reqrep ^([^ :]*) /blog/(.*) 1 /2
reqrep ^([^ :]*) /blog/wp-admin/(.*) 1 /2
cookie SERVERID insert indirect nocache
server www-1 private_ip_address:80 check cookie
Everything looks fine except one thing. I'm able to see the login page at https://my-website.com/blog/wp-login.php
. But, after I login, it redirects me to https://my-website.com/wp-admin
.
This is not what I want. I was expecting to get https://my-website.com/blog/wp-admin
.
I added this to my wp-config.php but it didn't help:
// Start custom config ---
define( 'FORCE_SSL_ADMIN', true );
define('FORCE_SSL_LOGIN', true);
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
$_SERVER['HTTPS']='on';
// End custom config ---
/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';
Did I miss something here? What is wrong here?
haproxy wordpress
haproxy wordpress
edited May 9 at 6:42
Zulhilmi Zainudin
asked May 9 at 6:20
Zulhilmi ZainudinZulhilmi Zainudin
1013
1013
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You configured the WordPress base URL with https://example.com/
. You should be able to go manually to https://example.com/blog/wp-admin/
after logging in. Then configure the base URL properly (https://example.com/blog/
) in the general settings of WordPress.
If that doesn't work you can manually configure the URL in the database, the setting is in the table wp_options
.
I changed it but the problem persists. See this - i.imgur.com/SGWMj1Y.png
– Zulhilmi Zainudin
May 9 at 6:40
well then look through the database if you find the wrong URL referenced anywhere. You spare yourself a lot of work if you set up WordPress using the URL you want to use it finally.
– Gerald Schneider
May 9 at 6:43
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f966504%2fhaproxy-wordpress-in-subdirectory-login-into-wp-admin-redirects-to-root%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You configured the WordPress base URL with https://example.com/
. You should be able to go manually to https://example.com/blog/wp-admin/
after logging in. Then configure the base URL properly (https://example.com/blog/
) in the general settings of WordPress.
If that doesn't work you can manually configure the URL in the database, the setting is in the table wp_options
.
I changed it but the problem persists. See this - i.imgur.com/SGWMj1Y.png
– Zulhilmi Zainudin
May 9 at 6:40
well then look through the database if you find the wrong URL referenced anywhere. You spare yourself a lot of work if you set up WordPress using the URL you want to use it finally.
– Gerald Schneider
May 9 at 6:43
add a comment |
You configured the WordPress base URL with https://example.com/
. You should be able to go manually to https://example.com/blog/wp-admin/
after logging in. Then configure the base URL properly (https://example.com/blog/
) in the general settings of WordPress.
If that doesn't work you can manually configure the URL in the database, the setting is in the table wp_options
.
I changed it but the problem persists. See this - i.imgur.com/SGWMj1Y.png
– Zulhilmi Zainudin
May 9 at 6:40
well then look through the database if you find the wrong URL referenced anywhere. You spare yourself a lot of work if you set up WordPress using the URL you want to use it finally.
– Gerald Schneider
May 9 at 6:43
add a comment |
You configured the WordPress base URL with https://example.com/
. You should be able to go manually to https://example.com/blog/wp-admin/
after logging in. Then configure the base URL properly (https://example.com/blog/
) in the general settings of WordPress.
If that doesn't work you can manually configure the URL in the database, the setting is in the table wp_options
.
You configured the WordPress base URL with https://example.com/
. You should be able to go manually to https://example.com/blog/wp-admin/
after logging in. Then configure the base URL properly (https://example.com/blog/
) in the general settings of WordPress.
If that doesn't work you can manually configure the URL in the database, the setting is in the table wp_options
.
answered May 9 at 6:27
Gerald SchneiderGerald Schneider
7,18432748
7,18432748
I changed it but the problem persists. See this - i.imgur.com/SGWMj1Y.png
– Zulhilmi Zainudin
May 9 at 6:40
well then look through the database if you find the wrong URL referenced anywhere. You spare yourself a lot of work if you set up WordPress using the URL you want to use it finally.
– Gerald Schneider
May 9 at 6:43
add a comment |
I changed it but the problem persists. See this - i.imgur.com/SGWMj1Y.png
– Zulhilmi Zainudin
May 9 at 6:40
well then look through the database if you find the wrong URL referenced anywhere. You spare yourself a lot of work if you set up WordPress using the URL you want to use it finally.
– Gerald Schneider
May 9 at 6:43
I changed it but the problem persists. See this - i.imgur.com/SGWMj1Y.png
– Zulhilmi Zainudin
May 9 at 6:40
I changed it but the problem persists. See this - i.imgur.com/SGWMj1Y.png
– Zulhilmi Zainudin
May 9 at 6:40
well then look through the database if you find the wrong URL referenced anywhere. You spare yourself a lot of work if you set up WordPress using the URL you want to use it finally.
– Gerald Schneider
May 9 at 6:43
well then look through the database if you find the wrong URL referenced anywhere. You spare yourself a lot of work if you set up WordPress using the URL you want to use it finally.
– Gerald Schneider
May 9 at 6:43
add a comment |
Thanks for contributing an answer to Server Fault!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f966504%2fhaproxy-wordpress-in-subdirectory-login-into-wp-admin-redirects-to-root%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown