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:
- An organization uses a Proxy to route traffic from their Applications to the vFunction Server
- The Proxy only accepts application/json Content Type Requests
- The $VF_SERVER/token Request made by the vFunction Controller to the vFunction Server uses the application/x-www-form-urlencoded Content Type
- 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
- Access the machine on which the Application and vFunction Controller runs
- 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
- 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
- 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"