Uploaded image for project: 'Red Hat 3scale API Management'
  1. Red Hat 3scale API Management
  2. THREESCALE-6736

Wrong Content-Length header when using payload limits policy

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 2.11.0 GA
    • 2.9 GA, 2.10 Dev, 2.10 CR1
    • Gateway
    • False
    • False
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • +
    • Undefined
    • Hide
      1. Create service with Response/Requests content limits policy (response = 100)
      2. Send a curl request to apicast with path `/bytes/101` (endpoint will return 101 bytes of content)
      3. Observe curl error `curl: (18) transfer closed with 163 bytes remaining to read`

      api_backend: https://httpbin.org

      Policy chain:

      "policy_chain": [
                  {
                      "name": "apicast",
                      "version": "builtin",
                      "configuration": {}
                  },
                  {
                      "name": "payload_limits",
                      "version": "builtin",
                      "configuration": {
                          "response": 100
                      }
                  }
              ],
      
      Show
      Create service with Response/Requests content limits policy (response = 100) Send a curl request to apicast with path `/bytes/101` (endpoint will return 101 bytes of content) Observe curl error `curl: (18) transfer closed with 163 bytes remaining to read` api_backend: https://httpbin.org Policy chain: "policy_chain" : [ { "name" : "apicast" , "version" : "builtin" , "configuration" : {} }, { "name" : "payload_limits" , "version" : "builtin" , "configuration" : { "response" : 100 } } ],

    Description

      When Response/Requests content limits policy blocks response from upstream (greater content limit than allowed) apicast returns status code (413) which is correct, and body of response says `Payload Too Large` (17 bytes), but Content-Length header is set to 180 bytes.

      Response from curl:

      curl -v "https://svc-jsmadis-palod-mrvj-3scale-apicast-staging.<3scale-url>:443/bytes/101?user_key=fc723253b7bea0e26a3874c23b0f054e"
      *   Trying 10.8.47.92:443...
      * Connected to svc-jsmadis-palod-mrvj-3scale-apicast-staging.<3scale-url> (<IP>) port 443 (#0)
      * ALPN, offering h2
      * ALPN, offering http/1.1
      * successfully set certificate verify locations:
      *  CAfile: /etc/ssl/certs/ca-certificates.crt
      *  CApath: none
      * TLSv1.3 (OUT), TLS handshake, Client hello (1):
      * TLSv1.3 (IN), TLS handshake, Server hello (2):
      * TLSv1.2 (IN), TLS handshake, Certificate (11):
      * TLSv1.2 (IN), TLS handshake, Server key exchange (12):
      * TLSv1.2 (IN), TLS handshake, Server finished (14):
      * TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
      * TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
      * TLSv1.2 (OUT), TLS handshake, Finished (20):
      * TLSv1.2 (IN), TLS handshake, Finished (20):
      * SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
      * ALPN, server did not agree to a protocol
      * Server certificate:
      *  subject: C=CZ; ST=Czech Republic; L=Brno; O=Red Hat s.r.o; OU=ApiQe; CN=<URL>
      *  start date: Nov 10 23:02:00 2020 GMT
      *  expire date: Nov 10 23:02:00 2021 GMT
      *  subjectAltName: host "svc-jsmadis-palod-mrvj-3scale-apicast-staging.<3scale-url>" matched cert's "*.<3scale-url>"
      *  issuer: C=US; ST=Nort Carolina; L=Raleigh; O=Red Hat Inc; OU=Api-Qe CertAuthority
      *  SSL certificate verify ok.
      > GET /bytes/101?user_key=fc723253b7bea0e26a3874c23b0f054e HTTP/1.1
      > Host: svc-jsmadis-palod-mrvj-3scale-apicast-staging.<3scale-URL>
      > User-Agent: curl/7.75.0
      > Accept: */*
      > 
      * Mark bundle as not supporting multiuse
      < HTTP/1.1 413 Request Entity Too Large
      < Server: openresty
      < Date: Fri, 19 Feb 2021 11:55:39 GMT
      < Content-Type: text/html
      < Content-Length: 180
      < Set-Cookie: 131ca74af652a36ec6a0e3a69723bacc=97b5b22133af174165aa138f18ab72d8; path=/; HttpOnly; Secure
      < 
      * TLSv1.2 (IN), TLS alert, close notify (256):
      * transfer closed with 163 bytes remaining to read
      * Closing connection 0
      curl: (18) transfer closed with 163 bytes remaining to read
      Payload Too Large%     
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            jsmadis Jakub Smadis (Inactive)
            Eloy Coto Eloy Coto (Inactive)
            David Rajnoha David Rajnoha (Inactive)
            Eloy Coto Eloy Coto (Inactive)
            Eloy Coto Eloy Coto (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: