How to avoid “502 Proxy Error” when adding large documents via Service Layer
If you have ever tried to add large documents (500+ lines) to SAP Business One using SAP Business One Service Layer on HANA, you may have encountered the following error:
502 Proxy Error
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request POST /b1s/v1/InventoryGenEntries
Reason: Error reading from remote server
However, even if you got the error message, which is basically a timeout between the Apache Load Balancer and one of its members, you may notice sometime later, that the document (or business object in general) was created successfully.
The solution is quite simple:
Log into your HANA server, and open the /usr/sap/SAPBusinessOne/ServiceLayer/conf/httpd-b1s-lb.conf file.
Within the file, change the following section, adding the line in red:
BalancerMember http://localhost:50001/b1s route=node0
BalancerMember http://localhost:50002/b1s route=node1
BalancerMember http://localhost:50003/b1s route=node2
The timeout value is expressed in seconds, which means 1800 gives you 30 minutes as maximum timeout. That should be more than sufficient for documents with 5000 lines including bin allocations.
After that, restart your Service Layer (/etc/init.d/b1s restart) and try again!
Let me know if you have any comments!