How to set isHTTPStatusTooManyRequestEnabled to return 429 http response

Not applicable

Hi All

I am using a Quota policy that return 500 http error. a want to change this response to 429 Too Many Requests http response.

On the documentation page it says that I need to set

features.isHTTPStatusTooManyRequestEnabled property to true

Does anyone know how to do this ?

Note:

We have Apigee Edge installed on local environment

The documentation page :

http://apigee.com/docs/api-services/content/comparing-quota-spike-arrest-and-concurrent-rate-limit-p...

Thanks for your help

Solved Solved
0 15 1,348
1 ACCEPTED SOLUTION

adas
Participant V

Sorry, I assumed you were talking about the Apigee Edge on cloud version. Here' what you need to do to set the flag:

PUT http://{mgmtIp}:{mgmtPort)/v1/organizations/apigee-org
Content-Type: application/xml
Authorization: Basic {sysadmin}


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Organization type="paid" name="apigee-org">
    <DisplayName>apigee-org</DisplayName>
    <Properties>
        <Property name="features.isHTTPStatusTooManyRequestEnabled">true</Property>
    </Properties>
</Organization>

Couple of things about this api:

- You need to run this as the sysadmin, orgadmin may not not rights to change some of these properties

- If you have any other <Property> set in the org level, make sure you pass them in the org UPDATE call. The api would overwrite the existing properties with the <Property> list passed in the call.

Hope this helps.

View solution in original post

15 REPLIES 15

adas
Participant V

You need to call Apigee support to get this done. This is done through the organization UPDATE call.

At this point, its based on the organization level flag because of backward compatibility. At some point we would make this as the default behaviour for quota failures, till then you have to rely on this flag. Please raise a support ticket if you want this to be enabled for your org.

Not applicable

Thanks for your quick reply,

We have Apigee Edge running on our local environment (onPrem installation), we are not using the cloud.

Do we still have to call Apigee support to do this even if we are managing our own environment?

Do you have a link where we can raise a support ticket ?

Thanks in advance for your help.

adas
Participant V

Sorry, I assumed you were talking about the Apigee Edge on cloud version. Here' what you need to do to set the flag:

PUT http://{mgmtIp}:{mgmtPort)/v1/organizations/apigee-org
Content-Type: application/xml
Authorization: Basic {sysadmin}


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Organization type="paid" name="apigee-org">
    <DisplayName>apigee-org</DisplayName>
    <Properties>
        <Property name="features.isHTTPStatusTooManyRequestEnabled">true</Property>
    </Properties>
</Organization>

Couple of things about this api:

- You need to run this as the sysadmin, orgadmin may not not rights to change some of these properties

- If you have any other <Property> set in the org level, make sure you pass them in the org UPDATE call. The api would overwrite the existing properties with the <Property> list passed in the call.

Hope this helps.

@Floyd Jonesnot sure if i found this in docs. Please do add it its not there.

We do have it covered in the docs in a couple of places, like the bottom of this page: http://apigee.com/docs/api-services/content/comparing-quota-spike-arrest-and-concurrent-rate-limit-p.... But we should update it with the UPDATE guidance. So for update, I'm assuming that's a PUT, correct?

Not applicable

Many thanks, I will try this 🙂

Not applicable

I tried this

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Organization name="myOrg">
    <DisplayName>myOrg</DisplayName>
    <Properties>
      <Property name="features.isHTTPStatusTooManyRequestEnabled">true</Property>
    </Properties>
</Organization>

the Authorization was not working for me (getting 401) I removed it and got 200 response :

{
    "createdAt": 1427297025577,
    "createdBy": "myUser",
    "displayName": "myOrg",
    "environments": [
        "myEnv1",
        "myEnv2"
    ],
    "lastModifiedAt": 1430816346768,
    "lastModifiedBy": "myUser",
    "name": "myOrg",
    "properties": {
        "property": [
            {
                "name": "features.isHTTPStatusTooManyRequestEnabled",
                "value": "true"
            }
        ]
    },
    "type": "paid"
}

But My API still return 500 instead of 429

Any suggestion how to check the organization properties

Thanks

adas
Participant V

The property seems to be correctly updated. I am wondering if you have any raiseFault policy in your apiproxy which is interfering with this. Would you be able to disable any such raiseFault policy in your proxy (set enabled="true" in the policy) and see if that helps. Additionally, also look for the status code in trace immediately after the quota policy.

Not applicable

I set enabled to false for my raiseFault, and did the test again.

I got the same error :

"{"fault":{"faultstring":"Rate limit quota violation. Quota limit : 10 exceeded by 1. Total violation count : 1. Identifier : some-token","detail":{"errorcode":"policies.ratelimit.QuotaViolation"}}}"

still getting 500 error

adas
Participant V

Its hard to say what's going on without looking at your proxy bundle. If you would not mind sharing, can email me the proxy zip file to adas@apigee.com

Not applicable

I sent a zip of the bundle to you email

Thanks

adas
Participant V

Nothing wrong with the bundle. I was able to get a 429 response by enabling the property using the organization UPDATE call. I responded to your email, please let me know how it goes and if you still have issues.

Not applicable

Still not working, I have a doubt about the apige edge version we have apigee-edge-4.14.07.00. Do you think this version contains isHTTPStatusTooManyRequestEnabled feature

You need to have 4.15.07.01 to make use of this feature. This is not available in 4.14.07.00 release.

adas
Participant V

I went back and looked through our release notes. This feature was released as part of our on-premise release 4.15.01 which is a major upgrade after 4.14.07. There are other major enhancements and bug fixes which adds to the stability and feature set of the Apigee Edge product. Here's the complete list:

http://apigee.com/docs/release-notes/content/4150100-apigee-edge-premises-release-notesWould recommend the upgrade to 4.15.01 and then apply the patches in 4.15.01.03 (which has fixes for known issues). The installer should be available in your ftp account. Please reach out to our support ticket if you have any questions related to the upgrade or see any issues during the actual upgrade process.