In case the actual request-body is empty it seems not Content-Type header is set by browsers.
Tested on a vm with stopping and starting a container via GUI (/api2/extjs/nodes/<nodename>/lxc/<vmid>/status/stop) fixes f398a3d94bb5c798e1e1ea91113cd76648dd79eb Reported-by: Friedrich Weber <f.we...@proxmox.com> Reported-by: Fiona Ebner <f.eb...@proxmox.com> Signed-off-by: Stoiko Ivanov <s.iva...@proxmox.com> --- src/PVE/APIServer/AnyEvent.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/PVE/APIServer/AnyEvent.pm b/src/PVE/APIServer/AnyEvent.pm index 6831a86..1fd7a74 100644 --- a/src/PVE/APIServer/AnyEvent.pm +++ b/src/PVE/APIServer/AnyEvent.pm @@ -745,7 +745,8 @@ sub proxy_request { my $content; if ($method eq 'POST' || $method eq 'PUT') { - if ($reqstate->{request}->header('Content-Type') =~ 'application/json') { + my $request_ct = $reqstate->{request}->header('Content-Type'); + if (defined($request_ct) && $request_ct =~ 'application/json') { $headers->{'Content-Type'} = 'application/json'; $content = encode_json($params); } else { -- 2.30.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel