phpmyadmin不适用于相同的req.http.host,不同的req.url

时间:2018-10-31 16:00:28

标签: varnish

对于不同的req.url,但对于相同的http.host,我有不同的后端。 因此,例如:example.com/one转到一个后端,example.com / two转到另一个后端。网站本身运行良好。我遇到的问题是,当我编写example.com/one/_pa_ad(这是phpmyadmin别名)时,将显示该页面,但是我无法登录数据库。直接在后端工作就可以了。

default.vcl的相关部分:

backend web230 {
    .host = "10.10.10.230";
    .port = "80";
    .first_byte_timeout = 60s;
    .connect_timeout = 300s; }
backend web235 {
    .host = "10.10.10.235";
    .port = "80";
    .first_byte_timeout = 60s;
    .connect_timeout = 300s; }
backend web237 {
    .host = "10.10.10.237";
    .port = "80";
    .first_byte_timeout = 60s;
    .connect_timeout = 300s;

# ADD TRAILING SLASH
if ((req.url ~ "/carrot$") && (!(req.url ~ "index.php"))) {
        set req.url = req.url + "/";
}

if ((req.url ~ "/speaker$") && (!(req.url ~ "index.php"))) {
        set req.url = req.url + "/";
}
if ((req.url ~ "/random$") && (!(req.url ~ "index.php"))) {
        set req.url = req.url + "/";
}


 #REDIRECT TO HTTPS AND INSERT www leaf
if (std.port(local.ip) == 80 && req.http.host ~ "(www\.)?auto-bild.ro(:[0-9]+)?$") {
    set req.http.x-redir = "https://" + req.http.host + req.url;
    return(synth(850, "Moved permanently"));
}

if (std.port(local.ip) == 80 && req.http.host ~ "(www\.)?example.com(:[0-9]+)?$") {
    set req.http.x-redir = "https://" + req.http.host + req.url;
    return(synth(850, "Moved permanently"));
}

if (std.port(local.ip) == 80 && req.http.host ~ "(www\.)?yetanother.com(:[0-9]+)?$") {
    set req.http.x-redir = "https://" + req.http.host + req.url;
    return(synth(850, "Moved permanently"));
}
if (std.port(local.ip) == 80 && req.http.host ~ "(www\.)?someother.com(:[0-9]+)?$") {
    set req.http.x-redir = "https://" + req.http.host + req.url;
    return(synth(850, "Moved permanently"));
}
if (std.port(local.ip) == 80 && req.http.host ~ "(www\.)?thirddomain.com") {
    set req.http.x-redir = "https://" + req.http.host + req.url;
    return(synth(850, "Moved permanently"));
}


if (req.method == "PUT") {
    set req.http.x-method = req.method;
    return (pass);
 }

if (req.method == "PATCH") {
    set req.http.x-method = req.method;
    return (pass);
}





 else if (req.http.host ~ "(www\.)?example.com" && req.url ~ "^/speaker/_pa_ad/?") {
        set req.backend_hint = web235;
        return (pass);
        }
   else if (req.http.host ~ "(www\.)?example.com" && req.url ~ "^/speaker/") {
        set req.backend_hint = web235;
        }
   else if (req.http.host ~ "(www\.)?example.com" && req.url ~ "^/carrot/_pa_ad/?") {
        set req.backend_hint = web237;
        return (pass);
        }
   else if (req.http.host ~ "(www\.)?example.com" && req.url ~ "^/carrot/") {
        set req.backend_hint = web237;
        }
   else if (req.http.host ~ "(www\.)?example.com" && req.url ~ "^/random/") {
    set req.backend_hint = web44;
 } else if (req.http.host ~ "(www\.)?example.com" && req.url ~ "^/_pa_ad/?") {
    set req.backend_hint = web230;
    return (pass);
 } else if (req.http.host ~ "(www\.)?example.com(:[0-9]+)?$") {
    set req.backend_hint = web230;

因此,对于www.example.com/carrot/_pa_ad而言,它不起作用。也许我把句子的顺序错误了?

在这种情况下,我不确定什么是常规设置。我在互联网上还没有看到任何类似的东西,只是对不同的req.url使用了不同的后端,对phpmyadmin也没有使用。在/etc/phpmyadmin/apache.conf上,我有别名/ carrot / _pa_ad / usr / share / phpmyadmin,在config.inc.php中,我有以下一行:

$cfg['PmaAbsoluteUri'] = $_SERVER["REQUEST_SCHEME"] . '://' . $_SERVER['SERVER_NAME'] . dirname($_SERVER['PHP_SELF']);

我也只是尝试编写https://example.com/carrot/_pa_ad而不是所有那些php变量,但这是行不通的。

请让我知道是否需要添加其他内容。

0 个答案:

没有答案