Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Get request of QNetworkAcccessManager always fail on https server
Qt 6.11 is out! See what's new in the release blog

Get request of QNetworkAcccessManager always fail on https server

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 1.6k Views 1 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.
  • thamT Offline
    thamT Offline
    tham
    wrote on last edited by tham
    #1
    1. Due to the requests of customers, I cannot tell you the link, sorry about the inconvenient.
    2. I tried to do a get request from a https server, but it keep on giving me the response "Error transferring https://some_address - server replied: Bad Gateway".
    3. The same codes can download the page of https://github.com without any issues, and I have tried on different ssl protocol. connect to ssl error signal but received nothing, pretty sure it is not ssl issue
    4. The server is build by nodejs, forward the call by nginx, using loopback api.

    I have asked the developers what is wrong, but they don't know, I have asked them do I need some sort of authorization, they say don't need + I cannot access their codes, do anyone have the ideas?Thanks

    Simplest codes

    QNetworkRequest request(url);
    request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
    auto *reply = manager_->get(request); //manager is QNetworkAccessManager
    //some connections
    
    JonBJ 1 Reply Last reply
    0
    • thamT tham
      1. Due to the requests of customers, I cannot tell you the link, sorry about the inconvenient.
      2. I tried to do a get request from a https server, but it keep on giving me the response "Error transferring https://some_address - server replied: Bad Gateway".
      3. The same codes can download the page of https://github.com without any issues, and I have tried on different ssl protocol. connect to ssl error signal but received nothing, pretty sure it is not ssl issue
      4. The server is build by nodejs, forward the call by nginx, using loopback api.

      I have asked the developers what is wrong, but they don't know, I have asked them do I need some sort of authorization, they say don't need + I cannot access their codes, do anyone have the ideas?Thanks

      Simplest codes

      QNetworkRequest request(url);
      request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
      auto *reply = manager_->get(request); //manager is QNetworkAccessManager
      //some connections
      
      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @tham said in Get request of QNetworkAcccessManager always fail on https server:

      I tried to do a get request from a https server, but it keep on giving me the response "Error transferring https://some_address - server replied: Bad Gateway".

      I just to be 100% clear, you say that https address positively does work without "Bad Gateway" if, say, you enter it into your browser?

      thamT 1 Reply Last reply
      0
      • JonBJ JonB

        @tham said in Get request of QNetworkAcccessManager always fail on https server:

        I tried to do a get request from a https server, but it keep on giving me the response "Error transferring https://some_address - server replied: Bad Gateway".

        I just to be 100% clear, you say that https address positively does work without "Bad Gateway" if, say, you enter it into your browser?

        thamT Offline
        thamT Offline
        tham
        wrote on last edited by tham
        #3

        @JonB It works with postman.

        edit : Another weird things I did not mentioned is, some api works with QNetworkAccessManager, while postman do not work, but some api only work with postman, bizarre

        Pablo J. RoginaP 1 Reply Last reply
        0
        • thamT tham

          @JonB It works with postman.

          edit : Another weird things I did not mentioned is, some api works with QNetworkAccessManager, while postman do not work, but some api only work with postman, bizarre

          Pablo J. RoginaP Offline
          Pablo J. RoginaP Offline
          Pablo J. Rogina
          wrote on last edited by
          #4

          @tham you need to use tools that will help you understand what's going on, if not you'll continue going blindly...

          1. Netwrok traffic capture -> Wireshark will show you what's is actually sent by your Qt app and what is actually the server replying
          2. Logging -> Ask the server's admin/developers you try connecting to for logging enties showing what the server is receiving/why is deciding to return "Bad Gateway" response
          3. From documentation:

          The HyperText Transfer Protocol (HTTP) 502 Bad Gateway server error response code indicates that the server, while acting as a gateway or proxy, received an invalid response from the upstream server
          could you check that you don't have a proxy in the middle, or that this server you're connecting to is indeed trying to connect to some other destination

          1. Do you have the signal sslErrors() connected to a slot to analyze the SSL errors?

          Upvote the answer(s) that helped you solve the issue
          Use "Topic Tools" button to mark your post as Solved
          Add screenshots via postimage.org
          Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

          thamT 1 Reply Last reply
          3
          • Pablo J. RoginaP Pablo J. Rogina

            @tham you need to use tools that will help you understand what's going on, if not you'll continue going blindly...

            1. Netwrok traffic capture -> Wireshark will show you what's is actually sent by your Qt app and what is actually the server replying
            2. Logging -> Ask the server's admin/developers you try connecting to for logging enties showing what the server is receiving/why is deciding to return "Bad Gateway" response
            3. From documentation:

            The HyperText Transfer Protocol (HTTP) 502 Bad Gateway server error response code indicates that the server, while acting as a gateway or proxy, received an invalid response from the upstream server
            could you check that you don't have a proxy in the middle, or that this server you're connecting to is indeed trying to connect to some other destination

            1. Do you have the signal sslErrors() connected to a slot to analyze the SSL errors?
            thamT Offline
            thamT Offline
            tham
            wrote on last edited by
            #5

            @Pablo-J.-Rogina

            1. Thanks for suggesting Wireshark
            2. The developers are finding the issues, still don't know what is going on yet
            3. The doc for me is simple, upload json file with ContentTypeHeader "application/json", the format and data of the json I uploaded is correct(confirm)
            4. Yes, I connect to the slot, but it do not show any error.
            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