【发布时间】:2019-05-13 00:29:14
【问题描述】:
我有一个在 haproxy 服务器上运行的 WordPress 网站,在运行 httpd 和 MySQL 复制的两台服务器之间进行循环
我发现在上传图片或更改特定相册的视图网格时,在没有在 WordPress 媒体库中设置持久连接的情况下使用 haproxy 时会出现问题。我正在尝试找出是否有可能为特定 URL 设置 cookie 的方法,该 URL 可能是 wp-admin 路径,访问者的网站的其余部分将是循环方法,没有持久连接,以提高负载平衡效率
我当前的 haproxy 配置是
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
tune.ssl.default-dh-param 1024
maxconn 4096
user haproxy
group haproxy
daemon
defaults
log global
mode http
option httplog
option dontlognull
option forwardfor
option http-server-close
timeout http-request 30s
timeout queue 1m
timeout connect 30s
timeout client 1m
timeout server 1m
timeout http-keep-alive 0s
timeout check 30s
#---------------------------------------------------------------------
# HAPROXY STATS
#---------------------------------------------------------------------
listen webfarm 192.168.1.2:80
mode http
stats enable
stats uri /haproxy?stats
stats realm Haproxy\ Statistics
stats auth username:password
#---------------------------------------------------------------------
# WEBSERVER
#---------------------------------------------------------------------
frontend https-in
bind *:443 transparent ssl crt /etc/ssl/private/website.pem
#reqadd X-Forwarded-Proto:\ https
default_backend https-backend
backend https-backend
balance roundrobin
option httpclose
option forwardfor
cookie website.com insert indirect nocache
#enter the IP of your application here
server web01 192.168.1.2:443 maxconn 1024 check ssl verify none
server web02 192.168.1.3:443 maxconn 1024 check ssl verify none
我的问题是如何为任何包含 wp-admin 正则表达式的 URL 启用 cookie?
【问题讨论】:
标签: wordpress centos load-balancing haproxy