You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: Troubleshoot HTTP 502.2 Bad Gateway error in CGI applications
3
3
description: Describes HTTP 502.2 Bad Gateway error in CGI applications and provides troubleshooting steps to resolve this issue.
4
-
ms.date: 04/09/2012
4
+
ms.date: 12/31/2024
5
5
ms.author: haiyingyu
6
6
author: HaiyingYu
7
7
ms.reviewer: johnhart
8
8
ms.custom: sap:Site Behavior and Performance\Runtime errors and exceptions, including HTTP 400 and 50x errors
9
9
---
10
10
# Troubleshoot HTTP 502.2 Bad Gateway error in CGI applications
11
11
12
-
_Applies to:_ Internet Information Services 6.0, Internet Information Services 7.0
12
+
_Applies to:_ Internet Information Services
13
13
14
14
This article describes HTTP 502.2 Bad Gateway error in Common Gateway Interface (CGI) applications and provides troubleshooting steps to resolve this issue.
15
15
16
16
## Symptom
17
17
18
-
You have a Web site that is hosted on Internet Information Services (IIS) 7.0. When you visit the Web site in a Web browser, you may receive an error message that resembles the following:
18
+
You have a Web site that is hosted on Internet Information Services (IIS). When you visit the Web site in a Web browser, you might receive an error message that resembles the following one:
19
19
20
20
> Server Error in Application \<application name\>
21
21
> HTTP Error 502.2 - Bad Gateway
@@ -24,13 +24,12 @@ You have a Web site that is hosted on Internet Information Services (IIS) 7.0. W
24
24
25
25
## Cause
26
26
27
-
This problem occurs because the CGI process terminates unexpectedly before the CGI process sends a response back to IIS 7.0.
27
+
This problem occurs because the CGI process terminates unexpectedly before the CGI process sends a response back to IIS.
28
28
29
29
## Tools
30
30
31
-
- Tracing module on IIS 7.X
32
-
-[Enterprise Tracing for Windows (ETW Tracing)](/windows-hardware/drivers/devtest/event-tracing-for-windows--etw-) on IIS 6.0
@@ -81,69 +80,6 @@ HTTP: Data: Number of data bytes remaining = 232 (0x00E8)
81
80
82
81
Capture [FREB](troubleshoot-php-with-failed-request-tracing.md) log for the HTTP error message and locate which module is throwing this error message.
83
82
84
-
Troubleshoot the CGI process executable file to determine why the CGI process terminates unexpectedly. You may have to generate a memory dump file of the CGI process when the access violation occurs.
85
-
86
-
This problem occurs when the CGI application does exactly what the error suggests: inserts invalid data into the HTTP Header value(s) that is sends to IIS as part of its response. In IIS 6 with Windows 2003 SP1 installed, you can use ETW Tracing to see what the CGI is returning.
87
-
88
-
### Capture a Trace file using ETW Tracing
89
-
90
-
1. Copy the ETWSetup.zip file to the IIS6 Server.
91
-
1. Extract it on the server.
92
-
1. Open the folder from the command prompt.
93
-
1. Enter _iis6trace-start.cmd_ to start the tracing.
94
-
1. Reproduce the issue.
95
-
1. Enter _iis6trace-stop.cmd_ to stop the tracing.
96
-
1. At this point, you should have an _iistrace\_etl.etl_ file in that folder.
97
-
1. Zip up that file and send it to Microsoft Support Engineer.
98
-
1. Support engineer can help you convert ETL file into XML.
99
-
1. Here is an example trace file from this sort of CGI problem:
Troubleshoot the CGI process executable file to determine why the CGI process terminates unexpectedly. You might have to generate a memory dump file of the CGI process when the access violation occurs.
For some reasons, the CGI application is ended prematurely. Notice the value of the headers entry. It's empty. This is why the error is sent to the client that the CGI is sending a bad set of headers. It is in fact sending an empty list of headers.
138
-
139
-
Line 446 shows the 502 that is sent to the client. It's actually a 502.2 (substatus of 2):
This problem occurs when the CGI application does exactly what the error suggests, inserting invalid data into the HTTP header values that are sent to IIS as part of its response.
0 commit comments