Were you ever able to find a solution to this? I have the same exact scenario - python flask API hosted on IIS using FastCGI which always resolves to the base URL when trying to hit it from a custom connector using an on-premise gateway.
I can get it working successfully in the following two tests:
1) Testing using the swagger editor in the connector (after enabling CORs module in IIS)
2) Running the python flask app from command line instead of IIS