Jump to content
LucasV

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>

Share this post


Link to post
Share on other sites
Posted (edited)

[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)

Share this post


Link to post
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. 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More