Web Request - Issue with url-encoded

Hello,

I am using the Web request action:

and getting this error:

{
	"responseData": {
		"message": "Request failed with status code 400",
		"name": "Error",
		"stack": "Error: Request failed with status code 400\n    at createError (/usr/src/app/node_modules/axios/lib/core/createError.js:16:15)\n    at settle (/usr/src/app/node_modules/axios/lib/core/settle.js:17:12)\n    at RedirectableRequest.handleResponse (/usr/src/app/node_modules/axios/lib/adapters/http.js:211:9)\n    at RedirectableRequest.emit (events.js:314:20)\n    at RedirectableRequest._processResponse (/usr/src/app/node_modules/follow-redirects/index.js:269:10)\n    at ClientRequest.RedirectableRequest._onNativeResponse (/usr/src/app/node_modules/follow-redirects/index.js:50:10)\n    at Object.onceWrapper (events.js:421:26)\n    at ClientRequest.emit (events.js:314:20)\n    at HTTPParser.parserOnIncomingClient (_http_client.js:601:27)\n    at HTTPParser.parserOnHeadersComplete (_http_common.js:122:17)",
		"config": {
			"url": "https://-----------/connect/token",
			"method": "post",
			"data": "{}",
			"headers": {
				"Accept": "application/json, text/plain, */*",
				"Content-Type": "application/x-www-form-urlencoded",
				"User-Agent": "Appfarm/108-0-17 ********/development (client-service/web-request)",
				"Content-Length": 2
			},
			"transformRequest": [
				null
			],
			"transformResponse": [
				null
			],
			"timeout": 30000,
			"responseType": "stream",
			"xsrfCookieName": "XSRF-TOKEN",
			"xsrfHeaderName": "X-XSRF-TOKEN",
			"maxContentLength": null
		}
	}
}

I can confirm that same request works in Postman with Content-Type: ‘application/x-www-form-urlencoded’

New finding:


Unfortunately, the body is not sent when
image this is set to TRUE

Hello, and welcome to the Community!

Are you able to send a screenshot of the browser console or debugger when “Use Static IP” is turned off, so that we can explore closer and try to identify the error?

Thanks
Rhys
Appfarm

Point is that if I turn off “Use Static IP” I cannot make a call towards API I need to use, because it allows only whitelisted IP. We have provided AppFarm IP to API owner.

Response with “Use Static IP” = FALSE

{
	"responseData":
	"403 Forbidden Microsoft-Azure-Application-Gateway"
}

Hi!

I have identified the issue. “Use Static IP” actually does not preserve the Form values in such requests. Challenge is registered, and will try to get some priority on it.

Workaround: As long as we keep your solution on the same cluster behind the scenes (as we normally do), your IP is static anyhow (yet, not the same guarantee as when using “Use Static IP”).
So

  1. Do a web request towards webhook.site to see the IP address your solution is running
  2. Open up that IP address in the firewall as well, and to not tick the “Use Static IP” in the web request.

Thank you @kristian, looking forward for a fix, meanwhile we will try to use suggested workaround.