Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Get request of QNetworkAcccessManager always fail on https server
tham last edited by tham
- Due to the requests of customers, I cannot tell you the link, sorry about the inconvenient.
- 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".
- 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
- 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
QNetworkRequest request(url); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); auto *reply = manager_->get(request); //manager is QNetworkAccessManager //some connections
JonB last edited by
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
httpsaddress positively does work without "Bad Gateway" if, say, you enter it into your browser?
tham last edited by 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. Rogina last edited by
@tham you need to use tools that will help you understand what's going on, if not you'll continue going blindly...
- Netwrok traffic capture -> Wireshark will show you what's is actually sent by your Qt app and what is actually the server replying
- 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
- 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
- Do you have the signal sslErrors() connected to a slot to analyze the SSL errors?
tham last edited by
- Thanks for suggesting Wireshark
- The developers are finding the issues, still don't know what is going on yet
- 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)
- Yes, I connect to the slot, but it do not show any error.