Solved [Mapbox GL behind a corporate proxy] Host api.mapbox.com not found
-
Hello everyone,
I’m currently working on a project using the Mapbox GL plugin from Qt Location 5.9.
My Mapbox access token is properly set and I can successfully use the old Mapbox plugin.
However, when I use the GL plugin, I get a black screen with the following error:[ERROR] {qml_location_ma}[Setup]: loading style failed: Host api.mapbox.com not found
The internet connexion that I’m using is behind a corporate proxy.
So far, I have an access to the other map providers from the Map View (QML) example.
Thus, the proxy configuration appears to be properly set.I think the problem comes from the fact that Mapbox GL might use HTTPS while Mapbox might use HTTP.
Hence, I tried to set SSL certificates in my code but I did not get more success on my issue.Any idea how I could resolve this issue?
In advance, thank you for your help,
Best regards -
Hi and welcome to denote,
What OS are you running ?
How are you handling the OpenSSL .dlls ? -
Hi SGaist, thank you for your reply!
I am working on Ubuntu 14.04 LTS, sorry for not specify that earlier.
Thanks to your questions, I checked out my packages and OpenSSL seems to be properly installed as well as libssl and libssl-dev.
This webpage helped me a lot for that : https://help.ubuntu.com/community/OpenSSL
Do I need to specify some environment variables to make it work properly?Also, I remembered these two errors that was not a problem (until now?!)
qt.network.ssl: QSslSocket: cannot resolve SSLv2_client_method qt.network.ssl: QSslSocket: cannot resolve SSLv2_server_method
Are they related to my issue?
I tried to fix these two thanks to these webpages but without success:
- https://forum.qt.io/topic/16139/solved-qsslsocket-error-sslv2
- https://askubuntu.com/questions/711863/installing-qt-5-5-1-on-ubuntu-14-04-throws-qt-network-ssl-error-on-terminal
And finally, in my code, I tried to set the SSL configuration with the following code that is inspired from this webpage
https://www.ics.com/blog/using-self-signed-certificates-qt-codeQFile file(":/ssl/api.mapbox.com.crt"); file.open(QIODevice::ReadOnly); const QByteArray bytes = file.readAll(); const QSslCertificate certificate(bytes); QSslSocket::addDefaultCaCertificate(certificate);
I did not get more success with that...
In advance, thank you for your help,
Best regards -
Before anything else, can you reach the map box api using e.g. Postman ?
-
Thank you for your reply SGaist,
Using Postman, a GET request to api.mapbox.com returns a Status: 200 OK.
So, apparently, I think I can reach the API properly.
In advance, thank you for your help,
Best regardsEDIT: Using Postman again, I tried the following requests:
- a GET request to http://api.mapbox.com and I get a Status: 200 OK
- a GET request to https://api.mapbox.com and the request is blocked on loading status. After few minutes, I get the following result:
Could not get any response
There was an error connecting to https://api.mapbox.com.Why this might have happened:
- The server couldn't send a response: Ensure that the backend is working properly
- Self-signed SSL certificates are being blocked: Fix this by turning off 'SSL certificate verification' in Settings > General
- Client certificates are required for this server: Fix this by adding client certificates in Settings > Certificates
- Request timeout: Change request timeout in Settings > General
However, both of these addresses seems to be reachable with my web browser so I guess the first and the last proposition are invalid.
I also tried the second proposition and it still does not work.The third solution remains but it might be a problem for me to have the required elements... I'll check that...
Do you know how I could use a HTTP request to the mapbox api in Qt or how I can set properly my certificates in Qt?
Or do you have another idea? -
I'd check with the IT folks before trying anything and everything. They might give you good clues as to why you can't reach the https version of mapbox from Postman.
-
@Stephane-1234
could it be possible that the proxy does something with ssl certificates? that's not nice but common practice.... -
Thanks for your replies guys!
Just to give some news about this issue...I tried both of your solutions during these 2 weeks:
- The proxy does not seem to disturb the SSL certificates
- I talked a lot with the IT guys and it resulted as a dead end... There is no chance for me to do a manual configuration of the SSL certificates for security reasons.
I think it might work if we could re-use the system's SSL configuration into the application but I'm not sure if it's possible and I don't have plenty of time to spend on that anymore.
I'll be happy if you guys have another awesome idea on that but if not, I'll mark this issue as solved since this is a very specific problem that very few people will encounter.
Anyway, thanks a lot for your help on that!
Best regards