How to send Controller Token requests using application/json Content Type instead of application/x-www-form-urlencoded Content Type


Overview of the Issue

This issue occurs in the following circumstances:

  1. An organization uses a Proxy to route traffic from their Applications to the vFunction Server
  2. The Proxy only accepts application/json Content Type Requests
  3. The $VF_SERVER/token Request made by the vFunction Controller to the vFunction Server uses the application/x-www-form-urlencoded Content Type
  4. The Controller receives a 400 Bad Request Response from the Proxy when trying to generate the Token. And, subsequent vFunction APIs will not complete without a Token

Steps to Resolve the Issue

  1. Access the machine on which the Application and vFunction Controller runs
  2. Modify the installation.yaml
Sample Linux Location
$BASE_DIR/vfunction/etc/sysconfig/installation/instances/default-dotnet/installation.yaml
Sample Windows Location
$BASE_DIR\\vfunction\\config\\installation\\instances\\default-dotnet\\installation.yaml
  1. Add the field and value controller.json_auth: true
controller:
  name:
  host:
  org_id:
  app_id:
  client_id:
  client_secret:
  type: dotnet
  jolokia_port: 8778
  instance_id: 
  json_auth: true
  1. Run the upgrade or installation script to apply the changes and send future $VF_SERVER/token requests as application/json Content Types
Sample Linux Workflow
bash $BASE_DIR/vfunction/opt/vfunction/controller-installation/upgrade.sh -i default-dotnet
Sample Windows Workflow
powershell -NoProfile -ExecutionPolicy unrestricted -Command "$BASE_DIR\\vfunction\\controller-installation\\install.ps1 -instance default-dotnet -agentMode true -runAsServices false"