Jump to content

Webservice image upload 400 server error


Recommended Posts

Hi,

I'm switching from 1.6 to 1.7.
Ive got the 1.7 set up and connected with webservice to upload all products. 
Unfortunately the image upload does not work.

I get an 400 server errror:

Any suggestions?

HTTP/1.1 400 Bad Request
Date: Fri, 20 Mar 2020 13:20:04 GMT
Server: Apache
Content-Length: 226
Connection: close
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
</body></html>

Link to comment
Share on other sites

[Fri Mar 20 13:50:11.432473 2020] [error] [pid 110133] apache2_util.c(273): [client***:51945] [client ***] ModSecurity: Access denied with code 400 (phase 2). Match of "eq 0" against "REQBODY_ERROR" required. [file "/usr/local/httpd/conf/extra/httpd-modsecurity.conf"] [line "68"] [id "200002"] [msg "Failed to parse request body."] [data "Multipart: Invalid boundary in C-T (characters)."] [severity "CRITICAL"] [hostname "www.***.com"] [uri "/api/images/products/18"] [unique_id ""]

Edited by LucasV (see edit history)
Link to comment
Share on other sites

Hi all,

For those with the same problem. 
My solution was that our webhost had a security module (modsecurity) that prevented the image upload. 
We also had to change the boundry:

Connection: Keep-Alive
Content-Type: multipart/form-data; boundary="----20/03/2020 15:19:34"


to this:

Connection: Keep-Alive
Content-Type: multipart/form-data; boundary="----WEBSDRTOKGFTGHVFAAR"

from date and time to a random code. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...