我似乎无法让 Apache 指令ProxyPassReverseCookieDomain
真正地重写域。
我的指令设置如下:
ProxyPassReverseCookieDomain "myinternalproxydomain.com" "thepublicdomain.com"
我使用浏览器中的“网络”选项卡,可以看到Set-Cookie
域没有被更改。我看到 Set-Cookie 域为 或thepublicdomain.com
。.thepublicdomain.com
我尝试添加
ProxyPassReverseCookieDomain "myinternalproxydomain.com" ".thepublicdomain.com"
我已经搜索并阅读了文档,但我不明白为什么没有设置 cookie 的域。
<VirtualHost *:443>
DocumentRoot /var/www/myinternalproxydomain.com
ServerName myinternalproxydomain.com
SSLEngine on
SSLCertificateFile /etc/ssl/certs/my.crt
SSLCertificateKeyFile /etc/ssl/private/my.key
SSLCACertificateFile /etc/ssl/certs/my.ca-bundle
SSLProxyEngine On
ProxyRequests Off
ProxyHTMLEnable On
ProxyPreserveHost Off
ProxyHTMLInterp On
ProxyHTMLExtended On
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off
ProxyPass "/" "https://thepublicdomain.com/"
ProxyPassReverse / https://thepublicdomain.com/
ProxyPassReverseCookiePath / /
ProxyPassReverseCookieDomain "myinternalproxydomain.com" "thepublicdomain.com"
ProxyPassReverseCookieDomain "myinternalproxydomain.com" "thepublicdomain.com"
ProxyPassReverseCookieDomain "myinternalproxydomain.com" ".thepublicdomain.com"
DirectorySlash On
ProxyHTMLURLMap "https://thepublicdomain.com" "/"
<Proxy *>
AddDefaultCharset off
Order deny,allow
Deny from all
Allow from all
DirectorySlash On
</Proxy>
<Location />
ProxyHTMLEnable On
ProxyPassReverse "/"
ProxyPassReverseCookieDomain "myinternalproxydomain.com" "thepublicdomain.com"
ProxyPassReverseCookieDomain "myinternalproxydomain.com" ".thepublicdomain.com"
ProxyHTMLURLMap https://thepublicdomain.com /
RequestHeader unset Accept-Encoding
</Location>
<Directory "/var/www/myinternalproxydomain.com">
AllowOverride All
Order allow,deny
allow from all
Options FollowSymLinks
</Directory>
</VirtualHost>
有人能告诉我应该去哪里调试这个问题吗?
答案1
这ProxyPassReverseCookieDomain
指令的语法为:
ProxyPassReverseCookieDomain internal-domain public-domain [interpolate]
就像在这个例子中ProxyPassReverse
, 这顺序被颠倒(后端优先):
ProxyPass "/mirror/foo/" "http://backend.example.com/"
ProxyPassReverse "/mirror/foo/" "http://backend.example.com/"
ProxyPassReverseCookieDomain "backend.example.com" "public.example.com"
ProxyPassReverseCookiePath "/" "/mirror/foo"