When using CouchDB on Azure Container Apps, you may notice that forward slashes (/) in the _id field are unintentionally removed. This happens because Azure automatically decodes URL-encoded characters, converting %2F into / before passing the request to the application.
In case of on-prem, this behavior does not occur because the encoded slashes remain untouched, allowing the id to be stored correctly. Azure has a setting called AZURE_CONTAINER_APP_INGRESS_DECODE_URL. Set this to false to prevent automatic URL decoding.
az containerapp update \
--name couchdb-app \
--resource-group arkorg \
--set-env-vars AZURE_CONTAINER_APP_INGRESS_DECODE_URL=false
```
After making the changes, send a test request to CouchDB and check if `_id` is stored correctly:
```yaml
curl -k -X PUT "https://couchdb-app.agreeablepebble-2fc967be.centralindia.azurecontainerapps.io/db/https%3A%2F%2Fjenkins-url.com%2Fapache%2Fcouchdb%2Fissues" \
-u admin:admin123 \
-H "Content-Type: application/json" \
-d '{ "data": {} }'
If Azure continues to decode encoded slashes despite disabling AZURE_CONTAINER_APP_INGRESS_DECODE_URL, the best workaround is double encoding which I already suggested in comment is to use double encoding (%252F
instead of %2F
) .
Checkout- Azure Container App URL Decoding Issue
Please don't forget to upvote and accept it as an answer if it is helpful. Thanks