question

IDTF-6634 avatar image
0 Votes"
IDTF-6634 asked SnehaAgrawal-MSFT commented

502 - Web server received an invalid response while acting as a gateway or proxy server but I see a 200 response in the application log

I have created a tiny docker image of an app that stores files in in /home/media. I can see that the files are there even after I restart the application and listing all files in the directory also works but I get a 502 response when I try to access the files.

I see this in the browser:
502 - Web server received an invalid response while acting as a gateway or proxy server.

The application log says this:
2021-06-01T00:02:06.268746288Z: [INFO] 172.16.0.1 - jack [01/Jun/2021:00:02:06 +0000] "GET /content/anyflow/cloud4.png HTTP/1.1" 200 524176 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36"

Here is my Dockerfile:

 FROM php:7.3.0-apache

 COPY src/ /var/www/html/
 COPY htpasswd.template/etc/httpd/.htpasswd

 RUN mkdir -p /home/media/content
 RUN chown -R www-data:www-data /home/media

 RUN ln -s /home/media/content /var/www/html/content

 EXPOSE 80

I can download the files I uploaded to /var/www/html in the docker image but not the files I put in /home/media/content.

What could be wrong and how do I debug this?

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.

Just checking in to see if you have chance to see below response. If this answers your query, do click “Accept Answer” and Up-Vote for the same. And, if you have any further query do let us know.

0 Votes 0 ·

1 Answer

SnehaAgrawal-MSFT avatar image
0 Votes"
SnehaAgrawal-MSFT answered

Thanks for reaching here! Just to confirm if you have enabled diagnostics logging for your web app. There may be many reasons for 502 error.

You can follow this guide on Remote debugging web apps

You may also follow Troubleshoot HTTP 502 & 503 to narrow down this issue and see which one you are running into.

Please let us know if further query or issue remains.


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.