I am attempting to get a Flask API running on Apache2 Server but I am getting a net::ERR_CONNECTION_REFUSED
Since I am running the flask API on another server I am using a Proxy Reverse on my main apache server in the following manner:
Listen 5001
<VirtualHost *:5001>
ServerAdmin [email protected]
ServerName myapiserver.io
SSLEngine on
SSLOptions +ExportCertData
SSLCertificateFile /etc/ssl/myapiserver/STAR_myapiserver_io.crt
SSLCertificateKeyFile /etc/ssl/private/myapiserver/myapiserver.io.key
SSLCertificateChainFile /etc/ssl/myapiserver/SectigoRSADomainValidationSecureServerCA.crt
SSLProxyEngine on
ProxyPass / https://10.0.10.242:5001/
ProxyPassReverse / https://10.0.10.242:5001/
ProxyPreserveHost On
</VirtualHost>
My myapiserver
configuration:
Listen 5001
<VirtualHost *:5001>
ServerName myapiserver.io
SSLEngine on
SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
SSLCertificateFile /etc/ssl/private/myapiserver/STAR_myapiserver_io.crt
SSLCertificateKeyFile /etc/ssl/myapiserver/myapiserver.io.key
SSLCertificateChainFile /etc/ssl/myapiserver/SectigoRSADomainValidationSecureServerCA.crt
WSGIDaemonProcess restapi user=www-data group=www-data threads=4 python-path=/applications/restapi/env/lib/python3.10/site-packages
WSGIProcessGroup restapi
WSGIScriptAlias / /applications/restapi/restapi.wsgi
WSGIPassAuthorization On
<Directory /applications/restapi>
<Files restapi.wsgi>
Order allow,deny
Allow from all
</Files>
</Directory>
<Directory /applications/restapi/>
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
ErrorLog /applications/logs/restapi.error.log
LogLevel warn
CustomLog /applications/logs/restapi.access.log combined
</VirtualHost>
I have verified the firewall rules and the request is https://myapiserver.io:5001
The python code is launched like so:
if __name__ == "__main__":
app.run(host="0.0.0.0")
I cannot understand why it is not connecting and I have run out of options to try. Any assistance would be much appreciated.