0
我有一个PHP服务。 一个端点在这些服务中调用其他端点。 连接我使用guzzle。 从第一个端点发送到第二个的内容应该是application/json。 在码头上,它工作正常,但当我部署到Kubernetes, 在日志中,我看到请求内容是application/x-www-form-urlencoded。 即使内容类型是硬编码:Kubernetes更改内容类型
private function getPostRequestOptions($postData) : array
{
return [
'headers' => [
'Content-Type' => 'application/json',
'Request-ID' => $this->requestId
],
'body' => json_encode($postData),
'connect_timeout' => static::CONNECT_TIMEOUT,
'timeout' => static::TIMEOUT,
'http_errors' => true,
];
}
public function sendPost(string $path, $postData): \stdClass
{
return $this->executeRequest(
'POST',
$this->getFullUrl($path),
$this->getPostRequestOptions(
$postData
)
);
}
是否有人有任何线索,为什么会发生这样的吗?
你如何连接两个应用程序?你在使用Pod IP地址吗? Kubernetes服务? apiserver中的代理?我希望只有最后一个对http头有任何影响(因为它是一个http代理)。前两个是L3连接,不应该影响您的应用程序特定内容。 –