We are using OpenShift 3.4. Using a s2i PHP image for pod. When doing a curl from pod to an external resource it's returning 405 Not Allowed nginx/1.16.1. The code is running fine on the local setup. As I understood from web, it's due to the fact our own server is not allowing POST request and we need to configure it to allow the same.
$ch = curl_init($ldapAuthURL);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
$response = curl_exec($ch);
I am unable to resolve this, since I don't have any experience with OpenShift I tried looking for httpd file but it's to be found no where. The support team is not able to help either, they are saying they support image pushing and pulling only and it's our application code that is faulty.
To my dismay support team was right, It was an application issue. My team member has configured the URL of the frontend which was running an angular app on nginx. Hence the cryptic error 405 nginx since the frontend won't support post requests on that URL.
That's why there were no Nginx config files in the PHP pod since it was using Apache to serve the files.
Steps to resolve: