In azure container app, azure seems to remove removes forward slash / from URL

Raj S 5 Reputation points
2025-01-24T20:02:31.6166667+00:00

couchdb on azure container seems to have issue with azure forward slash /

When saving simple json in couchdb, azure seems to remove forward slash / in URL
Example when saving below json:
{ "_id": "https://jenkins-url.com/apache/couchdb/issues", "data": { } }
azure:
PUT /db/https%3A/jenkins-url.com/apache/couchdb/issues 201

couchdb on-prem:
PUT /db/https%3A%2F%2Fjenkins-url.com%2Fapache%2Fcouchdb%2Fissues 201

Notice that azure service removes / from URL

Azure Container Apps
Azure Container Apps
An Azure service that provides a general-purpose, serverless container platform.
692 questions
{count} vote

1 answer

Sort by: Most helpful
  1. Arko 4,150 Reputation points Microsoft External Staff Moderator
    2025-02-07T14:33:52.55+00:00

    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
    ```![enter image description here](https://i.imgur.com/WgJgvzy.png)
    
    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

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.