Post request over waitress server doesn't complete

I have created an Dash app which requires a post request to hit an API. When the application is run locally, the API hits properly, and returns child [“SUCCESS”] to a div (as expected) on the webpage, but when the same app is run on virtual machine using waitress, the application breaks after making the post request without returning anything.

Need to understand what could be the issue while using waitress?


Welcome to the community! :slight_smile:

I guess it could be many things… Could you share your script to run the service? Other than that, it could be related to the VM network configuration (like if the port you are running is open and so on…).

The port is open as I see the web application hosted on VM running fine on the redirected URL.

auth_data = {

        'grant_type'    : 'client_credentials',

        'client_id'     : client_id,

        'client_secret' : client_secret,

        'scope'         : 'read_content read_financial_data read_product_data read_user_profile'



       # create session instance

    with requests.Session() as session:

        headers = {"User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36"}

        auth_request =, data = auth_data, headers=headers)

        access_token_dict = json.loads(auth_request.text)

        access_token = access_token_dict['access_token']

        api_log_4 = ["--> Access token generated"]

        # update session headers

        session.headers.update({'Authorization':'Bearer '+ access_token})  

        request_query = json.loads(json_file)

        request =, json=request_query, headers = headers)

        results = json.loads(request.text)

        status_code = (request.status_code)

        api_log_4.append("--> Status Code : " + str(status_code))

The callback should returns api_log_4 value i.e. a child to a Div, which works fine in the local system, but fails on VM when used with waitress

I see… Could you try to test the post requests directly in the VM, to see what happens? Or maybe check the logs to see if any error appear in the callback where you are making these requests?

In any case, this error does not seem related to Dash.

On logging the POST request on the VM, I see the following logs after which the app breaks to update the dash component.

DEBUG:urllib3.connectionpool:Resetting dropped connection:
DEBUG:urllib3.connectionpool: "POST /XYZ HTTP/1.1" 200 None
INFO:waitress:Client disconnected while serving /_dash-update-component

Not sure how to deal with it.