我有一个在 haproxy 服务器上运行的 WordPress 网站,在运行 httpd 和 MySQL 复制的两台服务器之间进行循环
我发现在上传图片或更改特定相册的 View 网格时,在没有在 WordPress 媒体库中设置持久连接的情况下使用 haproxy 时会出现问题。我正在尝试找出是否有可能为特定 URL 设置 cookie,可能是 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?
最佳答案
您可以使用“ignore-persist”执行相反的操作并忽略某些 URL 的 cookie 持久性:https://cbonte.github.io/haproxy-dconv/2.0/configuration.html#ignore-persist
关于wordpress - 如何在hapyoxy配置中为特定的URL路径设置cookie,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56104565/