502 Proxy Error again

I’m experiencing the dreaded 502 error and I have not been able to get past it regardless of the number of locations. Tried it at all hours of the day in case there was a server overload. Even tried it using the openroute API playground, and get another type of error. I know the key is good, as I’ve been able to use it to do different things.

I’m completely out of ideas.

Here’s the curl post and the response.

curl -X POST ‘https://api.openrouteservice.org/v2/isochrones/driving-car’ -H ‘Content-Type: application/json; charset=utf-8’ -H ‘Accept: application/json, application/geo+json, application/gpx+xml, img/png; charset=utf-8’ -H 'Authorization: ’ -d ‘{“locations”:[[-96.2611607,38.979813],[-100.112218,39.3742674]],“range”:[300,260],“interval”:10,“range_type”:“distance”,“area_units”:“mi”,“units”:“mi”}’

502 Proxy Error

Proxy Error

The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request

Reason: Error reading from remote server

Here’s the playground api request and it’s return.

curl -X POST \
  'https://api.openrouteservice.org/v2/isochrones/driving-car' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -H 'Accept: application/json, application/geo+json, application/gpx+xml, img/png; charset=utf-8' \
  -H 'Authorization: ' \
  -d '{"locations":[[-96.2611607,38.979813],[-100.112218,39.3742674]],"range":[300,200],"interval":10,"range_type":"distance","area_units":"mi","units":"mi"}'

Invalid API key or access to this API has been disallowed

Are you passing in your API key with your request? (https://api.openrouteservice.org/v2/isochrones/driving-car?api_key=xxx)

Actually, I see you are using the authorisation header… maybe try it with the api_key in the url method and see if that fixes it as maybe if you are going through a proxy it is stripping off the authorisation header

Yes, I’m passing the API key, using the ‘Authorization’ header, just removed it so that it wasn’t public.

I used the api_key method, and it returned this.

{
“error”: “Authorization field/api_key missing in request. If you do not have a token, please sign up for one at https://openrouteservice.org
}

I also just looked at the response headers, and it appears that the system thinks I have reached my limit. However, I haven’t ran 500 requests in the last 24 hours so I’m not sure what to think.

HTTP/1.1 502 Bad Gateway
Server: nginx/1.10.3 (Ubuntu)
Date: Tue, 07 Jul 2020 20:34:37 GMT
Content-Type: text/html; charset=iso-8859-1
Content-Length: 341
Connection: keep-alive
X-Ratelimit-Limit: 500
X-Ratelimit-Remaining: 0
X-Ratelimit-Reset: 0

Yeh, the reporting of rate limits are a bit funny sometimes and don’t always show the correct figure. If you send your API key and the full request you are using to enquiry@openrouteservice.org I can have a look and see if there is an issue with the key

Seems to be working now for the most part. I’ll hold off until I can recreate the issue.
Thanks.

I’ve been having these errors intermittently today. While request size seems to play a role, I also seem to have found a solution.

I’m requesting some matrices (few to many) that are just below the rate limit of 2500 connections/request. These large request fail more often than not, but not consistently. I played around with other request (smaller size or different endpoint) and encountered no problem at all.

Somehow switching the destinations and sources also seemed to fix the issue. So instead of a ‘many to few’ matrix I requested a ‘few to many’ matrix. (And then of course adjusted how I handled the returns.) And there were no more issues. I fail to see how this is different in workload for the server but I hope this helps you and others.

edit: Forgot to thank you guys for this great service. It is absolutely wonderful for my thesis research.

Hmm, yes that does sound strange that reversing makes the issue go away. Maybe @HendrikLeuschner would know why as he is our “go to” Matrix guy

And glad that openrouteservice is being useful for your research :slight_smile:

Matrix actually runs better with few to many than with many to few. This is due to our current design (could use a rework, wouldnt even be a lot of work). Whats the error you’re getting? 502 proxy error?

I received a ‘Bad Gateway (HTTP 502)’ so not the 502 proxy error. I just latched on to this thread after searching for ‘502’ :sweat_smile: My bad.
Still, the error didn’t consistently appear. Only during parts of the day (European late mornings and early afternoons) and only for requests with many origins. It therefor seems like a server load issue to me. Changing from ‘many to few’ to ‘few to many’ completely solved it for me.

Alright, great. If you have any other problems, please open separate issues for them here. We will look into making the matrix better with many to few