+ Start a Discussion
Prakash NawalePrakash Nawale 

System.HttpResponse[Status=Gateway Time-out, StatusCode=504]

We building integration between Salesforce and PHP.
Build REST service in PHP to fetch data from MySQL database and return data in JSON format. It is working fine for first 2-3 Callouts then Salesforce shows us Gateway timeout Error in debug logs. We tested web-service with ARC,Postman,https://www.hurl.it/ many mores and it's working fine.
Below are the HTTP Request code.
Request
string searchText = 'buzz';
HttpRequest req = new HttpRequest();
req.setEndpoint('http://domainname.com/api/getQueryData.php?cachebuster=' + system.now().millisecond());
req.setMethod('POST');
req.setTimeout(30000);
req.setHeader('Accept', '*/*');
req.setHeader('Cache-Control', 'no-store');
req.setHeader('Content-Type','application/json');
string bodyReqeust = 'SELECT * FROM  tableName where '; 
bodyReqeust = bodyReqeust +' Name LIKE \'%'+searchText+'%\'';
bodyReqeust = bodyReqeust +' OR Description LIKE \'%'+searchText+'%\'';
bodyReqeust = bodyReqeust +' LIMIT 10';

map<string,object> mapRequest = new map<String,object>();
req.setBody(JSON.serialize(mapRequest));

Http http = new Http();
HTTPResponse res = http.send(req);
system.debug('res.getBody()::'+res.getBody());

Response :

System.HttpResponse[Status=Gateway Time-out, StatusCode=504] System.HttpResponse[Status=Gateway Time-out, StatusCode=504]"|0x207ad0fb


ERROR: The requested URL could not be retrieved http://www.freecsstemplates.org Released for free under a Creative Commons Attribution 2.5 License

body :lang(fa) { direction: rtl; font-size: 100%; font-family: Tahoma, Roya, sans-serif; float: right; } :lang(he) { direction: rtl; } -->
"CacheHost: proxy-ord.net.salesforce.com
ErrPage: ERR_CONNECT_FAIL
Err: (110) Connection timed out
TimeStamp: Mon, 11 Sep 2017 12:13:02 GMT

ClientIP: 
ServerIP: 

HTTP Request:
POST /api/getQueryData.php?cachebuster=841 HTTP/1.1
Accept: */*
Cache-Control: no-store
User-Agent: SFDC-Callout/41.0
SFDC_STACK_DEPTH: 1
Content-Type: application/json
Pragma: no-cache
Host: domainname.com
Proxy-Connection: keep-alive
Content-Length: 138
X-Forwarded-For: 10.223.198.130
">support@salesforce.com</a>"

System.HttpResponse[Status=Gateway Time-out, StatusCode=504]

Can someone help Us?
Dhiliban Thangavel 7Dhiliban Thangavel 7
Hi,

You found any solution for this issue. As I am facing the same issue and assuming because of the SF Ip address is not whitelisted in third-party server. Any idea would be appreciated.

Thanks,
Dhiliban.
chen li 5chen li 5
Hi,
I'm facing this problem too, could you provide any solutions for this ?