Weird 502 bad gateway when using Httpresponse: content_type='text/csv' App service

JP 6 Reputation points
2022-02-22T16:28:49.62+00:00

Greetings everyone,

without knowingly changing anything, I suddenly get a "502 Bad Gateway" error when requesting a ~12-18KB *.csv file from my django backend running in Docker using the App Service.

  • All other calls to this backend, such as requesting JSON data, function properly in Azure.
  • The Log stream reveals that my Django Backend responds with a "HTTP/1.1" 200" success on the GET for the *.csv (just like with the other GETs )
  • The same GET for the *.csv works flawlessly when running the same DOCKER-compose container in my windows docker environment
  • The GET for the *.csv used to work before
  • The only difference to the functioning GETs is the content type, data & headers of the response :

response = HttpResponse(
content_type='text/csv',
headers={'Content-Disposition': 'attachment; filename="DownloadData.csv"'},
)

  • Given that all other GETs function properly & no other issues seem to be affecting the whole app I am out of ideas and posts to look for solutions. It doesn't seem to be CORS or access related. --> Does anyone have an idea why the 502 crops up?

Thank you for your time.
Pascal

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,631 questions
{count} votes

1 answer

Sort by: Most helpful
  1. JP 6 Reputation points
    2022-02-23T15:52:16.597+00:00

    To whoever has a similar problem: after a lot more searching & testing I believe that I have found the answer:
    -> The filename of the of the csv contained the symbol "ö".

    My guess is that this somehow did not pass through and somewhere cause an error on the way while I could not find those errors in the logs.
    Anyway, it works now.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.