Configuring ignore allow header for 405 property in Message Processors

You're viewing Apigee Edge documentation.
Go to the Apigee X documentation.
info

In the client-server communication, a server responds back with HTTP status code 405 Method Not Allowed if the HTTP request method presented by the client is known to the server but is not supported by the target resource. Similarly in Apigee Edge, the backend server can respond back with the HTTP status code 405 Method Not Allowed.

Apigee Edge expects the backend server to send 405 Method Not Allowed responses with the list of allowed methods in the Allow header, as per specification RFC 7231, section 6.5.5: 405 Method Not Allowed.

The Allow header must be sent in the following format:

Allow: HTTP_METHODS

For example, if your backend server allows GET, POST and HEAD methods, you need to ensure that the Allow header contains them as follows:

Allow: GET, POST, HEAD

If the backend server does not send the Allow header with the HTTP status code 405 Method Not Allowed, then Apigee returns HTTP status code 502 Bad Gateway with error code protocol.http.Response405WithoutAllowHeader to the client application. The recommended solution to address this error is to fix the backend server to adhere to the specification RFC 7231, section 6.5.5: 405 Method Not Allowed or use the fault handling to respond back with HTTP status code 405 Method Not Allowed including the Allow header as explained in the troubleshooting playbook 502 Bad Gateway - Response 405 without Allow header.

However, in some exceptional cases, it may not be possible to fix your backend or modify your API Proxy to address this issue immediately.

In such cases, you can set the ignore allow header for the 405 property HTTP.ignore.allow_header.for.405 at the Message Processor level temporarily. Setting this property to true prevents Apigee from returning the 502 Bad Gateway response to client applications even if the backend server sends HTTP status code 405 Method Not Allowed without the Allow header.

Once you are in a position to fix your backend server to send HTTP status code 405 Method Not Allowed with the Allow header, you can revert the property HTTP.ignore.allow_header.for.405 to its default value false.

Before you begin

Before you use the steps in this document, be sure you understand the following topics:

Configuring ignore allow header for 405 property to true on Message Processors

In Apigee Edge, the property HTTP.ignore.allow_header.for.405 is set to false, by default. This enables Apigee Edge to return the 502 Bad Gateway with error code protocol.http.Response405WithoutAllowHeader to the client applications if the backend server sends HTTP status code 405 Method Not Allowed without the Allow header. If you want to prevent Apigee Edge from sending 502 Bad Gateway to client applications, then you need to set the value of the property HTTP.ignore.allow_header.for.405 to trueon the Message Processors.

This section explains how to configure the property HTTP.ignore.allow_header.for.405 to true on the Message Processors, using the token as per the syntax described in How to configure Edge.

  1. On the Message Processor machine, open the following file in an editor. If it does not already exist, then create it.

    /opt/apigee/customer/application/message-processor.properties
    

    For example, to open the file using vi, enter the following:

    vi /opt/apigee/customer/application/message-processor.properties
    
  2. Add a line in the following format to the properties file:
    conf_http_HTTP.ignore.allow_header.for.405=true
    
  3. Save your changes.
  4. Ensure the properties file is owned by the apigee user as shown below:
    chown apigee:apigee /opt/apigee/customer/application/message-processor.properties
    
  5. Restart the Message Processor as shown below:
    /opt/apigee/apigee-service/bin/apigee-service edge-message-processor restart
    
  6. If you have more than one Message Processor, repeat the above steps on all the Message Processors.

Verifying ignore allow header for 405 property is set to true on Message Processors

This section explains how to verify that the property HTTP.ignore.allow_header.for.405 has been successfully updated to true on the Message Processors.

Even though you use the token conf_http_HTTP.ignore.allow_header.for.405 to update the value of the property on the Message Processor, you need to verify if the actual property HTTP.ignore.allow_header.for.405 has been set to true.

  1. On the Message Processor machine, search for the property HTTP.ignore.allow_header.for.405 in the /opt/apigee/edge-message-processor/conf directory and check to see if it has been set to true as shown below:
    grep -ri "HTTP.ignore.allow_header.for.405" /opt/apigee/edge-message-processor/conf
    
  2. If the property is successfully updated on the Message Processor, then the above command should show the value of the property HTTP.ignore.allow_header.for.405 as true in the http.properties file as shown below:
    /opt/apigee/edge-message-processor/conf/http.properties:HTTP.ignore.allow_header.for.405=true
    
  3. If you still see the value for the property HTTP.ignore.allow_header.for.405 as false then verify that you have followed all the steps outlined in Configuring ignore allow header for 405 property to true in Message Processors correctly. If you have missed any step, repeat all the steps again correctly.
  4. If you are still not able to modify the property HTTP.ignore.allow_header.for.405, then contact Apigee Edge Support.

Configuring ignore allow header for 405 property to false on Message Processors

This section explains how to configure the property HTTP.ignore.allow_header.for.405 to its default value false on the Message Processor, using the token as per the syntax described in How to configure Edge.

  1. Verify if the property HTTP.ignore.allow_header.for.405 is modified to true. You can do this by searching for this property in the /opt/apigee/edge-message-processor/conf directory and checking its value using the following command:
    grep -ri "HTTP.ignore.allow_header.for.405" /opt/apigee/edge-message-processor/conf
    
  2. If the property is set to true on the Message Processor, then the above command should show the value of the property HTTP.ignore.allow_header.for.405 as true in the http.properties file as shown below:
    /opt/apigee/edge-message-processor/conf/http.properties:HTTP.ignore.allow_header.for.405=true
    
  3. If the above command shows that the property HTTP.ignore.allow_header.for.405 is set to false (default value), then you don’t have to do anything else. That is, skip the following steps.
  4. If the property HTTP.ignore.allow_header.for.405 is set to true, then perform the following steps to revert to its default value false.
  5. On the Message Processor machine, open the following file in an editor:

    /opt/apigee/customer/application/message-processor.properties
    

    For example, to open the file using vi, enter the following:

    vi /opt/apigee/customer/application/message-processor.properties
    
  6. Remove the following line from the properties file:
    conf_http_HTTP.ignore.allow_header.for.405=true
    
  7. Save your changes.
  8. Ensure the properties file is owned by the apigee user as shown below:
    chown apigee:apigee /opt/apigee/customer/application/message-processor.properties
    
  9. Restart the Message Processor as shown below:
    /opt/apigee/apigee-service/bin/apigee-service edge-message-processor restart
    
  10. If you have more than one Message Processor, repeat the above steps on all the Message Processors.

Verifying ignore allow header for 405 property is set to false on Message Processors

This section explains how to verify that the property HTTP.ignore.allow_header.for.405 has been successfully updated to false on the Message Processors.

Even though you use the token conf_http_HTTP.ignore.allow_header.for.405 to update the value on the Message Processor, you need to verify if the actual property HTTP.ignore.allow_header.for.405 has been set to false.

  1. On the Message Processor machine, search for the property HTTP.ignore.allow_header.for.405 in the /opt/apigee/edge-message- processor/conf directory and check to see if it has been set to false as shown below:
    grep -ri "HTTP.ignore.allow_header.for.405" /opt/apigee/edge-message-processor/conf
    
  2. If the property is successfully updated on the Message Processor, then the above command should show the value of the property HTTP.ignore.allow_header.for.405 as false in the http.properties file as shown below:
    /opt/apigee/edge-message-processor/conf/http.properties:HTTP.ignore.allow_header.for.405=false
    
  3. If you still see the value for the property HTTP.ignore.allow_header.for.405 as true, then verify that you have followed all the steps outlined in Configuring ignore allow header for 405 property to false on Message Processors correctly. If you have missed any step, repeat all the steps again correctly.
  4. If you are still not able to modify the property HTTP.ignore.allow_header.for.405, then contact Apigee Edge Support.