It's all about the answers!

Ask a question

(502) Bad Gateway

magnus Elfving (345) | asked Oct 26 '21, 1:34 p.m.


I am running an external application (developed in Visual Basic) fetching information's from a Rhapsody (8.4) SYSML model and using this information to create and update artefacts/modules in DNG ( using the OSLC REST API. This has been working fine for a while.

Though, one procedure the Visual Basic application performs, is to query DNG for a large set of artifacts. That procedure is now failing by throwing an exception after ~60 seconds, see below:
  "System.Net.WebException occurred
  Message=The remote server returned an error: (502) Bad Gateway.
  Source=<Cannot evaluate the exception source>"

Other querying procedures still works, for instance, when querying for an artefact using the URL of the artefact

Can someone advise me what a probable cause and possible solution for the failing query?

Kind Regards


Accepted answer

permanent link
Ian Barnard (1.9k613) | answered Oct 27 '21, 3:47 a.m.
edited Nov 01 '21, 4:29 a.m.

Hi Magnus

If your deployment has a reverse proxy or is using WAS it sounds like this is timing out on what is presumably a lengthy query you're making to DOORS Next. The way a reverse proxy works is to accept the request from your application, create a new request (with the same data) to the target application (DOORS Next), wait (with a timeout) for the response, and when it's received create a response to your application. By working this way you can have a single fronting URL for ELM which the reverse proxy dispatches to different application servers to be serviced, allowing distribution of the load and greatly simplifying reconfiguration of the application servers.

You could ask your IT team to check the configuration of your reverse proxy/WAS to perhaps increase the timeout waiting for response.

You could also consider changing your application to make multiple smaller (i.e. quicker) queries rather than one enormous query.


magnus Elfving selected this answer as the correct answer

magnus Elfving commented Oct 28 '21, 8:59 a.m.

Thanks Ian.

I have notified the IT team and I will firstly evaluate the effects of change in the settings of timeout.

Using smaller queries; do you mean pagination or some other way to divide a query ?


Ian Barnard commented Oct 28 '21, 10:32 a.m.

Pagination will still require your server to find and handle the same large number of results albeit delivering them in smaller chunks.

I imagine making smaller queries (divide it into smaller queries) will be more effective.

Ian Barnard commented Oct 28 '21, 11:10 a.m.

 If you have any further problem with this, create a support case

magnus Elfving commented Nov 01 '21, 10:06 a.m.

I have now successfully queried DNG with increased setting for time out  

One other answer

permanent link
steve jonn (11) | answered Aug 30 '22, 2:05 a.m.

 The 502 (Bad Gateway) status code indicates that the server while acting as a gateway or proxy, received an invalid response from an inbound server it accessed while attempting to fulfill the request. The “proxy server” is a system or router that acts as a gateway between your computer and the internet.

How to fix?

Perform a hard-refresh in your browser. On Macs, this is done by pressing Cmd + Shift + R.

If you are surfing the Web and see this problem for all Web sites you try to visit, then either 1) your ISP has a major equipment failure/overload or 2) there is something wrong with your internal Internet connection e.g. your firewall is not functioning correctly. In the first case, only your ISP can help you. In the second case, you need to fix whatever it is that is preventing you reaching the Internet.

This problem is due to poor IP communication between back-end computers, possibly including the Web server at the site you are trying to visit. Before analysing this problem, you should clear your browser cache completely.

Finally, restart your computer/networking equipment. Some temporary issues with your computer and how it's connecting to your network could be causing 502 Bad gateway errors, especially if you're seeing the error on more than one website. In these cases, a restart would help.

Your answer

Register or to post your answer.