Ich versuche Nginx Proxy zu konfigurieren übergeben die Anfrage an einen anderen Server, nur wenn die Variable $ request_body auf einen bestimmten regulären Ausdruck übereinstimmt.Aber es funktioniert nicht für mich.Nginx bedingten Proxy-Pass basierend auf Anfrage Body Inhalt
server{
listen 80 default;
server_name www.applozic.com;
location/{
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
if ($request_body ~* (.*)appId(.*)) {
proxy_pass http://apps.applozic.com;
}
}
}
Anfrage Körper ist ::
{
"applicationId": "appId",
"authenticationTypeId": 1,
"enableEncryption": false,
"notificationMode": 0,
"deviceType": 4,
}
Mögliches Duplikat [nginx Spiel bestimmten Wort in Position] (https://stackoverflow.com/questions/7888165/nginx-match-specific-word-in-location) – AlexD