Supports user authentication and better error handling#23
Supports user authentication and better error handling#23zhanghaowx wants to merge 1 commit intosoftius:masterfrom
Conversation
* Use getallheaders() to fetch request headers so that fields like "Authorization" can be forwarded * remove urldecode when creating $request_url so that if csurl contains encoded part it won't be decoded by mistake * If curl_exec failed, send back plain text error message. E.g., Curl error: SSL certificate problem: unable to get local issuer certificate.
|
Hi @zhanghaowx, I understand that this PR introduce three fixes / improvements. Is it possible to explain Last, there is another PR dealing ( #24 ) with errors . |
|
Hi @softius, here is an example in real world usage: we want to request this url () through the proxy, https:///rest/v1/searchResults/page;firstResult=1;maxResults=50?fields=["ASSET_ID"]&filters=%7B%22classes%22:%5B%22GEO_NOTE_METADATA%22%5D,%22spatial%22:%7B%22operator%22:%22intersect%22,%22boundingBox%22:%7B%22lowerLeftLatY%22:48.164062500001,%22lowerLeftLonX%22:11.579589843751,%22upperRightLatY%22:48.175048828124,%22upperRightLonX%22:11.590576171874%7D%7D%7D As you can see, we have some encoded data in the URL parameters which will cause problem if we decode them before sending the actual request. For now it works fine for us, both request through ?csurl and HTTP_X_PROXY_URL |
|
For point 3, looks like #24 provides a more completed solution. Once you merged their changes, I will do some tests and see if it is still valid. I can also make 3 split PR requests if you prefer, which might be easier for you to manage. |
|
I agree that the urldecode might not be necessary for HTTP_X_PROXY_URL. But I still think is necessary for Also referring to the example provided the URL to be encoded / decoded is Last, indeed #24 provides a more completed solution in regards to error handling so I think this PR should be focused on necessary header adjustments to support user authentication and drop unnecessary url encode. Thanks |
"Authorization" can be forwarded
encoded part it won't be decoded by mistake
error: SSL certificate problem: unable to get local issuer certificate.