OpenFrameworks ofxHTTP call to pythonanywhere site gives SSL error

Here's the error:

[ error ] ofApp::setup: SSL Exception: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed

I am using the ofxHTTP library in OpenFrameworks (which uses a library called Poco I believe) to make an HTTP call:

// Testing redirects and https.
std::string url = "";

// Create a client.
ofxHTTP::Client client;

// Create a request.
ofxHTTP::GetRequest request(url);

// Create a context.
ofxHTTP::Context context;

// Set custom session settings.
// See the class documentation for many additional settings.
ofxHTTP::ClientSessionSettings sessionSettings;

// Use an iPhone X user agent string.
sessionSettings.setUserAgent("Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1");

// Set a 60 second keep-alive timeout (default is 8 seconds).
sessionSettings.setKeepAliveTimeout(Poco::Timespan::SECONDS * 60);

// Save the session settings with the context.

// Do the query!
    // Execute the request within the given context.
    auto response = client.execute(context, request);
    std::cout << response->getStatus() << std::endl;

    // Check the response.
    if (response->getStatus() == Poco::Net::HTTPResponse::HTTP_OK)
        // A successful response.
        ofLogError("ofApp::setup") << response->getStatus() << " " << response->getReason();
catch (const Poco::Exception& exc)
    ofLogError("ofApp::setup") << exc.displayText();

I checked my system image--everything is all new, I also only started using PythonAnywhere this year so I can't imagine anything being out of date. I have no issue calling another HTTPs website, so the issue only occurs with my PythonAnywhere site.

Please help!

That is not the address of your web app. The address for your web app is shown at the top of your web app configuration page.

Do you mean this url?


Sorry, I should have specified--the web app is hosting a Python/Flask API, which has a route called /getcoordinates. If I type it into the browser it works, and it also works with my Javascript app, just not with my OpenFrameworks app.

The URL should be, not -- the "www." at the start means that your request will go to a different server, which is not configured to run your website.

Yes, I did try it without the 'www' as well as you said. I still ran into the same SSL certificate error. I later added the 'www' because I was trying something I read about online but it didn't work and I forgot to remove it in the code I uploaded above.

There is no web app on domain as we do not host subdomains of default domains based on usernames.

Yes, so I have used the url

but I would still get errors

Yes, so I have used the url

but I would still get the same error.

That's very strange, then! When I access that URL it shows up as "Secure" in my browser. Where are you running the code that is getting the error? Is there a chance that the setup on that machine has an out-of-date set of root certificates?

I don't think the OF app on my machine has an out-of-date certificate because when I tried it with a different HTTPs call it worked :/

That doesn't mean it's not out of date. It just means that the site you tested was in the certificate store that you do have.

Can you point me to how I can renew the certificate so that I can use it in my OF app?

Since you are accessing the site with Python, you can probably just install the latest version of certifi