GCP Cloud Armor JSON parsing
By default, Google does not enable JSON-parsing for Cloud Armor policies. If you are using JSON in your requests, you should enable JSON-parsing.
How to enable JSON parsing for a Cloud Armor policy
Check if it's already disabled or enabled
By default, JSON parsing is disabled but it is not explicitly defined in the policy configurations. If you cannot get any hits when describing your policy, then it has not been enabled or disabled by anyone.
gcloud compute security-policies describe <cloud-armor-policy-name> --project <project-name> |grep -A4 advanced
If the output is for example:
advancedOptionsConfig:
jsonCustomConfig:
contentTypes:
- application/json
jsonParsing: STANDARD
or:
advancedOptionsConfig:
jsonCustomConfig:
contentTypes:
- application/json
jsonParsing: DISABLED
Then these configurations have been previously enabled or disabled and you should ask yourself why this has been done.
If however, you receive nothing, then there is no history with this setting and you can continue with a clear mind.
Enable the configuration
gcloud compute security-policies update <cloud-armor-policy-name> --json-parsing STANDARD --json-custom-content-types "application/json" --project <project-name>