Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. [Mapbox GL behind a corporate proxy] Host api.mapbox.com not found
Forum Updated to NodeBB v4.3 + New Features

[Mapbox GL behind a corporate proxy] Host api.mapbox.com not found

Scheduled Pinned Locked Moved Solved Installation and Deployment
8 Posts 3 Posters 4.3k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Stephane-1234
    wrote on 8 Jun 2017, 07:57 last edited by
    #1

    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

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 8 Jun 2017, 19:52 last edited by
      #2

      Hi and welcome to denote,

      What OS are you running ?
      How are you handling the OpenSSL .dlls ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Stephane-1234
        wrote on 9 Jun 2017, 11:41 last edited by
        #3

        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-code

            QFile 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

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 9 Jun 2017, 20:44 last edited by
          #4

          Before anything else, can you reach the map box api using e.g. Postman ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • S Offline
            S Offline
            Stephane-1234
            wrote on 12 Jun 2017, 08:00 last edited by Stephane-1234 6 Dec 2017, 15:25
            #5

            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 regards

            EDIT: 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?

            T 1 Reply Last reply 13 Jun 2017, 05:15
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 12 Jun 2017, 22:01 last edited by
              #6

              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.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1
              • S Stephane-1234
                12 Jun 2017, 08:00

                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 regards

                EDIT: 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?

                T Offline
                T Offline
                the_
                wrote on 13 Jun 2017, 05:15 last edited by
                #7

                @Stephane-1234
                could it be possible that the proxy does something with ssl certificates? that's not nice but common practice....

                -- No support in PM --

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  Stephane-1234
                  wrote on 26 Jun 2017, 08:05 last edited by Stephane-1234
                  #8

                  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

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved