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:
- Read the Playbook - 502 Bad Gateway - response 405 without Allow header.
- If you aren’t familiar with configuring properties for Edge on Private Cloud, read How to configure Edge.
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.
-
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
- Add a line in the following format to the properties file:
conf_http_HTTP.ignore.allow_header.for.405=true
- Save your changes.
- Ensure the properties file is owned by the
apigeeuser as shown below:chown apigee:apigee /opt/apigee/customer/application/message-processor.properties
- Restart the Message Processor as shown below:
/opt/apigee/apigee-service/bin/apigee-service edge-message-processor restart
- 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.
- On the Message Processor machine, search for the property
HTTP.ignore.allow_header.for.405in the/opt/apigee/edge-message-processor/confdirectory and check to see if it has been set totrueas shown below:grep -ri "HTTP.ignore.allow_header.for.405" /opt/apigee/edge-message-processor/conf
- 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.405astruein thehttp.propertiesfile as shown below:/opt/apigee/edge-message-processor/conf/http.properties:HTTP.ignore.allow_header.for.405=true
- If you still see the value for the property
HTTP.ignore.allow_header.for.405asfalsethen 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. - 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.
- Verify if the property
HTTP.ignore.allow_header.for.405is modified totrue. You can do this by searching for this property in the/opt/apigee/edge-message-processor/confdirectory and checking its value using the following command:grep -ri "HTTP.ignore.allow_header.for.405" /opt/apigee/edge-message-processor/conf
- If the property is set to
trueon the Message Processor, then the above command should show the value of the propertyHTTP.ignore.allow_header.for.405astruein thehttp.propertiesfile as shown below:/opt/apigee/edge-message-processor/conf/http.properties:HTTP.ignore.allow_header.for.405=true
- If the above command shows that the property
HTTP.ignore.allow_header.for.405is set tofalse(default value), then you don’t have to do anything else. That is, skip the following steps. - If the property
HTTP.ignore.allow_header.for.405is set totrue, then perform the following steps to revert to its default valuefalse. 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
- Remove the following line from the properties file:
conf_http_HTTP.ignore.allow_header.for.405=true
- Save your changes.
- Ensure the properties file is owned by the
apigeeuser as shown below:chown apigee:apigee /opt/apigee/customer/application/message-processor.properties
- Restart the Message Processor as shown below:
/opt/apigee/apigee-service/bin/apigee-service edge-message-processor restart
- 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.
- On the Message Processor machine, search for the property
HTTP.ignore.allow_header.for.405in the/opt/apigee/edge-message- processor/confdirectory and check to see if it has been set tofalseas shown below:grep -ri "HTTP.ignore.allow_header.for.405" /opt/apigee/edge-message-processor/conf
- 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.405asfalsein thehttp.propertiesfile as shown below:/opt/apigee/edge-message-processor/conf/http.properties:HTTP.ignore.allow_header.for.405=false
- If you still see the value for the property
HTTP.ignore.allow_header.for.405astrue, 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. - If you are still not able to modify the property
HTTP.ignore.allow_header.for.405, then contact Apigee Edge Support.