POST request returns 502 Bad Gateway intermittently

Even when I tried to Deploy my application via Node-RED, it somtimes got 502 error.

I just create very simple node-red application for testing purpose. It just receives GET and POST request with on parameter and returns basic html response that shows that parameter.

For GET, you can test it at https://testpost502.mybluemix.net/testget?id=1234.

For POST, you can call it at https://testpost502.mybluemix.net/testpost?id=1234.

It seems that for GET, it will not fail at all but for POST, it will fail with 502 error once every 10-20 calls or more. So, it may be POST that can cause this error (and yes, if deploy on Node-RED use POST, it will be affected).

Something is getting wrong with my node.js I guess.

[
{
"id": "6409895d.6fc088",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info": ""
},
{
"id": "802d4488.288318",
"type": "http in",
"z": "6409895d.6fc088",
"name": "",
"url": "/testpost",
"method": "post",
"upload": false,
"swaggerDoc": "",
"x": 150,
"y": 200,
"wires": [
[
"ab121371.9c37f",
"f43e7ab8.016478"
]
]
},
{
"id": "ab121371.9c37f",
"type": "template",
"z": "6409895d.6fc088",
"name": "done",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "\n\n \n \n Test\n \n \n \n id={{payload.id}}\n \n",
"output": "str",
"x": 370,
"y": 200,
"wires": [
[
"8bfa16.c191b5e8"
]
]
},
{
"id": "8bfa16.c191b5e8",
"type": "http response",
"z": "6409895d.6fc088",
"name": "",
"statusCode": "",
"headers": {},
"x": 560,
"y": 200,
"wires": []
},
{
"id": "f43e7ab8.016478",
"type": "debug",
"z": "6409895d.6fc088",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"x": 270,
"y": 120,
"wires": []
},
{
"id": "c799ce9.f96a93",
"type": "http in",
"z": "6409895d.6fc088",
"name": "",
"url": "/testget",
"method": "get",
"upload": false,
"swaggerDoc": "",
"x": 130,
"y": 360,
"wires": [
[
"3b6f9c43.9777c4",
"70c62290.2fad1c"
]
]
},
{
"id": "3b6f9c43.9777c4",
"type": "template",
"z": "6409895d.6fc088",
"name": "done",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "\n\n \n \n Test\n \n \n \n id={{req.query.id}}\n \n",
"output": "str",
"x": 360,
"y": 360,
"wires": [
[
"58df9427.933eac"
]
]
},
{
"id": "70c62290.2fad1c",
"type": "debug",
"z": "6409895d.6fc088",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"x": 260,
"y": 280,
"wires": []
},
{
"id": "58df9427.933eac",
"type": "http response",
"z": "6409895d.6fc088",
"name": "",
"statusCode": "",
"headers": {},
"x": 550,
"y": 360,
"wires": []
}
]

I contacted IBM Cloud Support team. They found stale route issue and had me restage my application. It worked OK since then.