我有一个运行在haproxy服务器上的WordPress网站,并且在运行httpd和MySQL复制的两台服务器之间进行轮询
我发现在使用haproxy时,在上传图片或更改特定相册的视图网格时未在WordPress媒体库中设置持久性连接时会出现问题。我正在尝试找出是否有可能为特定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 regex的任何URL启用cookie?
答案 0 :(得分:0)
您可以执行相反的操作,并使用“ ignore-persist”忽略某些URL的cookie持久性:https://cbonte.github.io/haproxy-dconv/2.0/configuration.html#ignore-persist