question

DafyddOwen-7907 avatar image
0 Votes"
DafyddOwen-7907 asked SnehaAgrawal-MSFT commented

Tomcat on Azure gives 502 Bad Gateway error if a file is over 48Kb

I have an old Java/JSP app deployed to an Azure App service.
Config:

  • Stack: Java

  • Java Version : 8 (auto update)

  • Java Web server : Tomcat 7

I'm not a Java/Tomcat developer and had a bit of a struggle migrating it to Azure.
Anyway - found a strange issue.
I realised that the page/browser wasn't loading the jquery file.
In Web browser dev-tools Console It was giving a 502.3 Bad Gateway error - or if I load the file direct it gives the generic "The specified CGI application encountered an error and the server terminated the process."

After a bit of trial and error I realised that it was a file size issue.
I've create multiple text files and they show the same issue.
48Kb - the text file is served by the web server no issue.
49Kb - even just one character more than the ok file - and the 502.3 / CGI error is given.

I can't imagine it's anything to do with the application itself as they're just text files.
So can only guess it's something to do with Azure / Tomcat - and am far from experienced on either.

I've tried getting detailed logs etc - and not getting very far - just saying it's a 502 error.


In the detailed error page downloaded from: \Log Files\DetailedErrors
Module httpPlatformHandler
Notification ExecuteRequestHandler
Handler httpPlatformHandlerMain
Error Code 0x80072f78
Requested URL http://<Azure app name>:80/test/test2.txt
Physical Path C:\home\site\wwwroot\test\test2.txt


In other logs giving:

Fields: date time s-sitename cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Cookie) cs(Referer) cs-host sc-status sc-substatus sc-win32-status sc-bytes cs-bytes time-taken

2021-03-30 14:41:33 <AZURE APP NAME> GET /test/test3.txt X-ARR-LOG-ID=3396835b-8169-4031-8fb9-1f453bab65bd 80 - 80.229.217.19 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/89.0.4389.90+Safari/537.36 ga=GA1.2.425743202.1478094549;+_utma=64269055.1697910558.1478128282.1603098244.1603100052.3017;+_gid=GA1.2.964745619.1617005796;+ARRAffinity=92ca53ad8db4fbb93d4d3b7d8ab54dcf8ffecb2d731f25b0e91ad575d7534c3f;+JSESSIONID=0F7607CB41252690D499895443A5D633 - <Azure custom URL> 502 3 12152 589 1301 17296
2021-03-30 14:41:33 <AZURE APP NAME> GET /test/test2.txt X-ARR-LOG-ID=54a45472-e683-45f1-9b6d-388c3a0d5fba 80 - 80.229.217.19 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/89.0.4389.90+Safari/537.36 ga=GA1.2.425743202.1478094549;+_utma=64269055.1697910558.1478128282.1603098244.1603100052.3017;+_gid=GA1.2.964745619.1617005796;+ARRAffinity=92ca53ad8db4fbb93d4d3b7d8ab54dcf8ffecb2d731f25b0e91ad575d7534c3f;+JSESSIONID=0F7607CB41252690D499895443A5D633 - <Azure custom URL>d 502 3 12152 589 1275 7859


I have tried 3 text files:
test1.txt : Just under the limit : Ok
test2.txt : 1 character more : 502.3 error
test3.txt : similar file size to 2 - but only carriage returns : 502.3 error

azure-webapps
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I've tried a similar Tomcat deployment with nothing but the text files : that site works Ok....

0 Votes 0 ·

1 Answer

DafyddOwen-7907 avatar image
0 Votes"
DafyddOwen-7907 answered SnehaAgrawal-MSFT commented

I updated it to Tomcat 9 (Auto update) and that seemed to work!

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Glad to hear that you got it working. Appreciate for sharing the steps which helped you, this would certainly benefit other community members.

0 Votes 0 ·