<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>https_client sample: connection refused</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/127869/https_client-sample-connection-refused</link><description>Hi, 
 We are working on a project in which data must be sent to server using NB-Iot. 
 We are struggling establishing an HTTPS connection with a server using the NRF9160 development kit. 
 As a starting point I copied some parts of the https_client sample</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 24 Apr 2026 12:51:10 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/127869/https_client-sample-connection-refused" /><item><title>RE: https_client sample: connection refused</title><link>https://devzone.nordicsemi.com/thread/565468?ContentTypeID=1</link><pubDate>Fri, 24 Apr 2026 12:51:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4cc57bfc-1582-451b-aec9-0f7125cce8f6</guid><dc:creator>ao38</dc:creator><description>&lt;p&gt;Hi Syed,&lt;/p&gt;
&lt;p&gt;I did a pristine build and it didn&amp;#39;t change the result.&lt;/p&gt;
&lt;p&gt;Adding the two lines you gave in the prj.conf, the log is now:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="powershell"&gt;HTTPS client sample started
Bringing network interface up
Provisioning certificate
Certificate match
Connecting to the network
+CEREG: 2,&amp;quot;79CD&amp;quot;,&amp;quot;07E42508&amp;quot;,7
+CSCON: 1
+CGEV: ME PDN ACT 0
%MDMEV: SEARCH STATUS 2
+CEREG: 5,&amp;quot;79CD&amp;quot;,&amp;quot;07E42508&amp;quot;,7,,,&amp;quot;11100000&amp;quot;,&amp;quot;11100000&amp;quot;
+CSCON: 0&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Thank you for your help.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Arthur&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: https_client sample: connection refused</title><link>https://devzone.nordicsemi.com/thread/565440?ContentTypeID=1</link><pubDate>Fri, 24 Apr 2026 09:08:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e40c7591-4e7f-481c-bf24-a522eb719ba3</guid><dc:creator>Syed Maysum Abbas Zaidi</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thanks for your response. First of all can you please confirm if you did pristine build after making the changes in prj.conf to make sure the issue is not related to stale build. Secondly your log shows&amp;nbsp;+CNEC_ESM: 50,0&amp;nbsp;means your network is providing IPv4 only, no IPv6. But the sample is configured for dual-stack (IPv4 + IPv6 by default), so it waits for an IPv6 address that never arrive and may be resulting in a&amp;nbsp;non-deterministic behavior.&lt;/p&gt;
&lt;p&gt;So if it still hangs after pristine build, you may tell the modem to request&amp;nbsp;IPv4 only, by adding the overlay, using any of the two ways below:&lt;/p&gt;
&lt;p&gt;1.&amp;nbsp;Pass it at build time:&lt;br /&gt;&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;west build -b nrf9160dk/nrf9160/ns -- -DEXTRA_CONF_FILE=overlay-pdn-nrf91-ipv4.conf&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;2.&amp;nbsp;Add the two lines directly to prj.conf:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_LTE_LC_PDN_DEFAULTS_OVERRIDE=y
CONFIG_LTE_LC_PDN_DEFAULT_FAM_IPV4=y&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Try these and let us know if it works. Thanks&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;br /&gt;Syed Maysum&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: https_client sample: connection refused</title><link>https://devzone.nordicsemi.com/thread/565410?ContentTypeID=1</link><pubDate>Thu, 23 Apr 2026 14:55:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:10c69423-436f-4e6f-a413-8ec1cc2e1bac</guid><dc:creator>ao38</dc:creator><description>&lt;p&gt;Hi Syed,&lt;/p&gt;
&lt;p&gt;Thank you very much for this thorough response, I tried changing the certificate, setting&amp;nbsp;&lt;span&gt;CONFIG_HTTPS_HOSTNAME in prj.conf as you proposed.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I am getting this log:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="powershell"&gt;*** Booting nRF Connect SDK v3.2.2-74845e169be2 ***
*** Using Zephyr OS v4.2.99-fe4f0106803e ***
HTTPS client sample started
Bringing network interface up
Provisioning certificate
Certificate match
Connecting to the network
+CEREG: 2,&amp;quot;BD84&amp;quot;,&amp;quot;09A19608&amp;quot;,7
+CSCON: 1
+CGEV: ME PDN ACT 0,0
+CNEC_ESM: 50,0
%MDMEV: SEARCH STATUS 2
+CEREG: 5,&amp;quot;BD84&amp;quot;,&amp;quot;09A19608&amp;quot;,7,,,&amp;quot;11100000&amp;quot;,&amp;quot;11100000&amp;quot;
+CSCON: 0&lt;/pre&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;It looks like&amp;nbsp;the code is stucked on taking the network connected semaphore (&lt;/span&gt;NET_EVENT_L4_CONNECTED is never triggered).&lt;/p&gt;
&lt;p&gt;I had a question concerning the modem initialization: how to choose if initialization is done at startup or by calling &amp;quot;nrf_modem_lib_init&amp;quot;? I don&amp;#39;t see any particular line in the https_client example prj.conf file.&lt;/p&gt;
&lt;p&gt;Thank you,&lt;/p&gt;
&lt;p&gt;Arthur&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: https_client sample: connection refused</title><link>https://devzone.nordicsemi.com/thread/565374?ContentTypeID=1</link><pubDate>Thu, 23 Apr 2026 09:02:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8ba80850-e5ae-4505-ba3a-e2fa187cad74</guid><dc:creator>Syed Maysum Abbas Zaidi</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;It looks the network is registering, DNS resolves, and the modem is fine. The only reason the sample failed against example.com is a certificate mismatch with that specific server. Since you are connecting to an AWS endpoint, here is what you need:&lt;/p&gt;
&lt;p&gt;First download the Amazon Root CA 1 certificate: &lt;a href="https://www.amazontrust.com/repository/AmazonRootCA1.pem"&gt;https://www.amazontrust.com/repository/AmazonRootCA1.pem&lt;/a&gt;, place it in the cert/ folder, replacing DigiCertGlobalG3.pem.&lt;/p&gt;
&lt;p&gt;Then update CMakeLists.txt, change the cert filename from DigiCertGlobalG3.pem to AmazonRootCA1.pem (and the .inc name to match).&amp;nbsp;Also&amp;nbsp;update src/main.c line 47, change the #include to &amp;quot;AmazonRootCA1.pem.inc&amp;quot;.&lt;/p&gt;
&lt;p&gt;Moreover you would need to&amp;nbsp;add&amp;nbsp;&lt;span&gt;CONFIG_HTTPS_HOSTNAME=&amp;quot;*******.eu-west-1.amazonaws.com&amp;quot;&lt;/span&gt;&amp;nbsp;(your actual server hostname) to prj.conf&lt;/p&gt;
&lt;p&gt;You may try getting the connection working on LTE-M first with these changes. Once that is confirmed, switching to NB-IoT is just one additional line in prj.conf (CONFIG_LTE_NETWORK_MODE_NBIOT=y), but first check that your iBASIS SIM has NB-IoT coverage in your country here: &lt;a href="https://ibasis.com/solutions/iot-connectivity/network-coverage/"&gt;https://ibasis.com/solutions/iot-connectivity/network-coverage/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Point to note that France shows LTE-M only on the iBASIS coverage map, I am afraid that for NB-IoT&amp;nbsp;you may&amp;nbsp;need a different SIM (maybe from French operator). The iBASIS test SIM won&amp;#39;t work for NB-IoT in France.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Let us know how it goes.&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;br /&gt;Syed Maysum&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: https_client sample: connection refused</title><link>https://devzone.nordicsemi.com/thread/565340?ContentTypeID=1</link><pubDate>Wed, 22 Apr 2026 15:16:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9ace939b-a09d-4da0-ba17-cab92130becc</guid><dc:creator>Achim Kraus</dc:creator><description>&lt;p&gt;OK. So you use the &amp;quot;nrf/samples/net/https_client&amp;quot; and you didn&amp;#39;t modify it?&lt;/p&gt;
&lt;p&gt;If so, I guess it fails, because the used trusted certificate in the sample is from&amp;nbsp;&lt;span class="head"&gt;&lt;span class="preview"&gt;www.digicert.com,&amp;nbsp;while currently &amp;quot;example.com&amp;quot; uses&amp;nbsp;SSL.com .&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;You may try it with the SSL.com root:&lt;/p&gt;
&lt;p&gt;-----BEGIN CERTIFICATE-----&lt;br /&gt;MIICOjCCAcCgAwIBAgIQFAP1q/s3ixdAW+JDsqXRxDAKBggqhkjOPQQDAzBOMQsw&lt;br /&gt;CQYDVQQGEwJVUzEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMSUwIwYDVQQDDBxT&lt;br /&gt;U0wuY29tIFRMUyBFQ0MgUm9vdCBDQSAyMDIyMB4XDTIyMDgyNTE2MzM0OFoXDTQ2&lt;br /&gt;MDgxOTE2MzM0N1owTjELMAkGA1UEBhMCVVMxGDAWBgNVBAoMD1NTTCBDb3Jwb3Jh&lt;br /&gt;dGlvbjElMCMGA1UEAwwcU1NMLmNvbSBUTFMgRUNDIFJvb3QgQ0EgMjAyMjB2MBAG&lt;br /&gt;ByqGSM49AgEGBSuBBAAiA2IABEUpNXP6wrgjzhR9qLFNoFs27iosU8NgCTWyJGYm&lt;br /&gt;acCzldZdkkAZDsalE3D07xJRKF3nzL35PIXBz5SQySvOkkJYWWf9lCcQZIxPBLFN&lt;br /&gt;SeR7T5v15wj4A4j3p8OSSxlUgaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSME&lt;br /&gt;GDAWgBSJjy+j6CugFFR781a4Jl9nOAuc0DAdBgNVHQ4EFgQUiY8vo+groBRUe/NW&lt;br /&gt;uCZfZzgLnNAwDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMDA2gAMGUCMFXjIlbp&lt;br /&gt;15IkWE8elDIPDAI2wv2sdDJO4fscgIijzPvX6yv/N33w7deedWo1dlJF4AIxAMeN&lt;br /&gt;b0Igj762TVntd00pxCAgRWSGOlDGxK0tk/UYfXLtqc/ErFc2KAhl3zx5Zn6g6g==&lt;br /&gt;-----END CERTIFICATE-----&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;but I don&amp;#39;t know, if that works.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: https_client sample: connection refused</title><link>https://devzone.nordicsemi.com/thread/565338?ContentTypeID=1</link><pubDate>Wed, 22 Apr 2026 14:26:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:10357ae6-81e3-4760-9283-eb83ca0d5f95</guid><dc:creator>ao38</dc:creator><description>&lt;p&gt;As I said in my first my message, I tried to use the sdk-nrf example https_client that&amp;#39;s why the hostname is not the same as the one for my application... I just wanted to test if connection is even possible in my lab that&amp;#39;s all.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: https_client sample: connection refused</title><link>https://devzone.nordicsemi.com/thread/565337?ContentTypeID=1</link><pubDate>Wed, 22 Apr 2026 14:22:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1b3c6361-f17a-4106-a46b-529d9a4cf94e</guid><dc:creator>Achim Kraus</dc:creator><description>&lt;p&gt;From your first message:&lt;/p&gt;
&lt;p&gt;+CEREG: 5,&amp;quot;BD84&amp;quot;,&amp;quot;09A19608&amp;quot;,7,,,&amp;quot;11100000&amp;quot;,&amp;quot;11100000&amp;quot;&lt;br /&gt;Network connectivity established and IP address assigned&lt;br /&gt;Looking up example.com&lt;br /&gt;Resolved 172.66.147.243 (AF_INET)&lt;br /&gt;Connecting to example.com:443&lt;br /&gt;connect() failed, err: 111&lt;/p&gt;
&lt;p&gt;From the last message:&lt;/p&gt;
&lt;p&gt;The actual server hostname is something like *******.eu-west-1.amazonaws.com&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What I see:&lt;/p&gt;
&lt;p&gt;&amp;gt;&amp;nbsp;+CEREG: 5,&amp;quot;BD84&amp;quot;,&amp;quot;09A19608&amp;quot;,7,,,&amp;quot;11100000&amp;quot;,&amp;quot;11100000&amp;quot;&lt;br /&gt;&amp;gt; Network connectivity established and IP address assigned&lt;/p&gt;
&lt;p&gt;device has registered successfully in the mobile network&lt;/p&gt;
&lt;p&gt;&amp;gt;&amp;nbsp;Looking up example.com&lt;br /&gt;&amp;gt; Resolved 172.66.147.243 (AF_INET)&lt;/p&gt;
&lt;p&gt;Your destination is &amp;quot;example.com&amp;quot;&lt;/p&gt;
&lt;p&gt;&amp;gt;&amp;nbsp;The actual server hostname is something like *******.eu-west-1.amazonaws.com&amp;nbsp;&lt;/p&gt;
&lt;p&gt;But &amp;quot;example.com&amp;quot; is not &amp;quot;eu-west-1.amazonaws.com&amp;quot;.&lt;/p&gt;
[quote userid="149180" url="~/f/nordic-q-a/127869/https_client-sample-connection-refused/565290"]the TLS handshake failed, most commonly due to a certificate mismatch. [/quote]
&lt;p&gt;The is pretty frequently the reason, when connecting to a different server. You would need to trust the proper CA (anchor certificate).&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: https_client sample: connection refused</title><link>https://devzone.nordicsemi.com/thread/565306?ContentTypeID=1</link><pubDate>Wed, 22 Apr 2026 11:37:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ab623b18-91b9-47ad-aeaa-80c049c05b5e</guid><dc:creator>ao38</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thank you very much for the quick answers &lt;a href="https://devzone.nordicsemi.com/members/syed-maysum-abbas-zaidi"&gt;Syed Maysum Abbas Zaidi&lt;/a&gt;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/members/achimkraus"&gt;Achim Kraus&lt;/a&gt;&amp;nbsp;!&lt;/p&gt;
&lt;p&gt;1. The actual server hostname is something like *******.eu-west-1.amazonaws.com&amp;nbsp;&lt;/p&gt;
&lt;p&gt;2. I use the test SIM card provided by Nordic (IBASIS), I was thinking maybe there are restrictions with this plan?&lt;/p&gt;
&lt;p&gt;3. The modem firmware version is: mfw_nrf9160_1.3.7&lt;/p&gt;
&lt;p&gt;Also the radio conditions are not very good in our lab...&lt;/p&gt;
&lt;p&gt;Thank you,&lt;/p&gt;
&lt;p&gt;Arthur&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: https_client sample: connection refused</title><link>https://devzone.nordicsemi.com/thread/565290?ContentTypeID=1</link><pubDate>Wed, 22 Apr 2026 09:10:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d75154e-5413-45b9-a938-9e31651b89dd</guid><dc:creator>Syed Maysum Abbas Zaidi</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thanks for the detailed information. Before we&amp;nbsp;suggest any changes, a few quick questions:&lt;/p&gt;
&lt;p&gt;1. What is the hostname of your actual target server?&lt;br /&gt;2. Which SIM/operator are you using, and do you know if NB-IoT is supported on it?&lt;br /&gt;3. What modem firmware version are you on? You can check by running AT+CGMR via the AT Client sample.&lt;/p&gt;
&lt;p&gt;On your nrf_modem_lib_init() question, you don&amp;#39;t need to call it explicitly when using the https_client sample. The board configuration for the nRF9160 DK handles modem initialization automatically in the background.&lt;/p&gt;
&lt;p&gt;Regarding the connect() failed, err: 111, this error on the nRF9160 typically means the TLS handshake failed, most commonly due to a certificate mismatch. Let us know the answers above and we&amp;#39;ll get you to a working HTTPS POST over NB-IoT with minimal changes.&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;br /&gt;Syed Maysum&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: https_client sample: connection refused</title><link>https://devzone.nordicsemi.com/thread/565276?ContentTypeID=1</link><pubDate>Wed, 22 Apr 2026 07:07:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:48d2e458-50c0-404e-b068-e682e7eb0977</guid><dc:creator>Achim Kraus</dc:creator><description>[quote userid="145055" url="~/f/nordic-q-a/127869/https_client-sample-connection-refused"]I must admit I am quite lost on which libraries to use (zephyr vs nrf) to setup Nb-IOT vs Lte-M and TLS.[/quote]
&lt;p&gt;The common setup is:&lt;/p&gt;
&lt;p&gt;TCP/TLS is done by the modem&amp;#39;s firmware&lt;/p&gt;
&lt;p&gt;NCS comes with the additional libraries to use the modem&lt;/p&gt;
&lt;p&gt;zephyr is the framework to use it.&lt;/p&gt;
&lt;p&gt;So you use both zephyr and NCS.&lt;/p&gt;
&lt;p&gt;A special setup uses&amp;nbsp;&lt;/p&gt;
&lt;p&gt;TCP by the modem&amp;#39;s firmware&lt;/p&gt;
&lt;p&gt;TLS by zephyr&lt;/p&gt;
&lt;p&gt;If that helps, is more a question, which issues you faced with the common approach.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;In general:&lt;/p&gt;
&lt;p&gt;NB-IoT would only support TCP/TLS on pretty good radio conditions. If the signals goes low, the RTT goes up and that may break TCP.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>