# HTTP Client Connect Timeout when curl command on same device works with the same endpoint

**URL:** <https://forum.inductiveautomation.com/t/http-client-connect-timeout-when-curl-command-on-same-device-works-with-the-same-endpoint/94244>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [August 6, 2024, 6:42pm UTC](https://forum.inductiveautomation.com/t/http-client-connect-timeout-when-curl-command-on-same-device-works-with-the-same-endpoint/94244 "2024-08-06T18:42:04Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cole\_Townsend](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cole_townsend/32/53149_2.png) [@Cole\_Townsend](https://forum.inductiveautomation.com/u/Cole_Townsend)\
**Post date:** [August 6, 2024, 6:42pm UTC](https://forum.inductiveautomation.com/t/http-client-connect-timeout-when-curl-command-on-same-device-works-with-the-same-endpoint/94244/1 "2024-08-06T18:42:04Z")

</div>

Hey guys,

I've run into an issue that I can't really figure out with the HTTP Client. I am trying to make a simple GET call to an endpoint, which I am able to successfully make from this same device using curl on the CLI, but as soon as I try to make the call using the httpClient, I can't seem to get a valid connection to the URL.

Can anyone think of a reason that ignition would not be able to connect, even though I have confirmed a good response for the same endpoint from the same device?  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/8/d869fe56b7743c448ce33348d248ea3d4a4423c6.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/3/231fbfd868dde91355c5732051b9b28db9f572fd.png)

```python
Java Traceback:
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "<module:httpGet>", line 4, in test
	at com.inductiveautomation.ignition.common.script.builtin.http.JythonHttpClient.send(JythonHttpClient.java:103)

	at com.inductiveautomation.ignition.common.script.builtin.http.JythonHttpClient.get(JythonHttpClient.java:306)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

	at java.base/java.lang.reflect.Method.invoke(Unknown Source)

java.io.IOException: java.io.IOException: Unable to GET http://192.168.1.1/api/status/system/modem_temperature

	at org.python.core.Py.JavaError(Py.java:547)

	at org.python.core.Py.JavaError(Py.java:538)

	at org.python.core.PyReflectedFunction. __call__ (PyReflectedFunction.java:192)

	at org.python.core.PyObject. __call__ (PyObject.java:422)

	at org.python.core.PyMethod.instancemethod ___call__ (PyMethod.java:237)

	at org.python.core.PyMethod. __call__ (PyMethod.java:228)

	at org.python.pycode._pyx69.test$1(<module:httpGet>:5)

	at org.python.pycode._pyx69.call_function(<module:httpGet>)

	at org.python.core.PyTableCode.call(PyTableCode.java:173)

	at org.python.core.PyBaseCode.call(PyBaseCode.java:119)

	at org.python.core.PyFunction. __call__ (PyFunction.java:406)

	at org.python.pycode._pyx68.f$0(<input>:1)

	at org.python.pycode._pyx68.call_function(<input>)

	at org.python.core.PyTableCode.call(PyTableCode.java:173)

	at org.python.core.PyCode.call(PyCode.java:18)

	at org.python.core.Py.runCode(Py.java:1687)

	at org.python.core.Py.exec(Py.java:1731)

	at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:277)

	at org.python.util.InteractiveInterpreter.runcode(InteractiveInterpreter.java:130)

	at com.inductiveautomation.ignition.designer.gui.tools.jythonconsole.JythonConsole$ConsoleWorker.doInBackground(JythonConsole.java:611)

	at com.inductiveautomation.ignition.designer.gui.tools.jythonconsole.JythonConsole$ConsoleWorker.doInBackground(JythonConsole.java:599)

	at java.desktop/javax.swing.SwingWorker$1.call(Unknown Source)

	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)

	at java.desktop/javax.swing.SwingWorker.run(Unknown Source)

	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

	at java.base/java.lang.Thread.run(Unknown Source)

Caused by: java.io.IOException: Unable to GET http://192.168.1.1/api/status/system/modem_temperature

	at com.inductiveautomation.ignition.common.script.builtin.http.JythonHttpClient.send(JythonHttpClient.java:103)

	at com.inductiveautomation.ignition.common.script.builtin.http.JythonHttpClient.get(JythonHttpClient.java:306)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

	at java.base/java.lang.reflect.Method.invoke(Unknown Source)

	at org.python.core.PyReflectedFunction. __call__ (PyReflectedFunction.java:190)

	... 24 more

Caused by: java.net.http.HttpConnectTimeoutException: HTTP connect timed out

	at java.net.http/jdk.internal.net.http.HttpClientImpl.send(Unknown Source)

	at java.net.http/jdk.internal.net.http.HttpClientFacade.send(Unknown Source)

	at com.inductiveautomation.ignition.common.script.builtin.http.JythonHttpClient.send(JythonHttpClient.java:101)

	... 30 more

Caused by: java.net.http.HttpConnectTimeoutException: HTTP connect timed out

	at java.net.http/jdk.internal.net.http.MultiExchange.toTimeoutException(Unknown Source)

	at java.net.http/jdk.internal.net.http.MultiExchange.getExceptionalCF(Unknown Source)

	at java.net.http/jdk.internal.net.http.MultiExchange.lambda$responseAsyncImpl$7(Unknown Source)

	at java.base/java.util.concurrent.CompletableFuture.uniHandle(Unknown Source)

	at java.base/java.util.concurrent.CompletableFuture$UniHandle.tryFire(Unknown Source)

	at java.base/java.util.concurrent.CompletableFuture.postComplete(Unknown Source)

	at java.base/java.util.concurrent.CompletableFuture.completeExceptionally(Unknown Source)

	at java.net.http/jdk.internal.net.http.Http1Exchange.lambda$cancelImpl$9(Unknown Source)

	... 3 more

Caused by: java.net.ConnectException: HTTP connect timed out

	... 11 more

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "<module:httpGet>", line 4, in test
	at com.inductiveautomation.ignition.common.script.builtin.http.JythonHttpClient.send(JythonHttpClient.java:103)

	at com.inductiveautomation.ignition.common.script.builtin.http.JythonHttpClient.get(JythonHttpClient.java:306)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

	at java.base/java.lang.reflect.Method.invoke(Unknown Source)

java.io.IOException: java.io.IOException: Unable to GET http://192.168.1.1/api/status/system/modem_temperature

```

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 6, 2024, 6:48pm UTC](https://forum.inductiveautomation.com/t/http-client-connect-timeout-when-curl-command-on-same-device-works-with-the-same-endpoint/94244/2 "2024-08-06T18:48:04Z")

</div>

You seem to be running this test from the script console, which means your script executes in the Designer, and the connection originates from the computer running the Designer. That you can curl from the CLI on that server is not relevant - can you make it work from your machine?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [August 6, 2024, 6:49pm UTC](https://forum.inductiveautomation.com/t/http-client-connect-timeout-when-curl-command-on-same-device-works-with-the-same-endpoint/94244/3 "2024-08-06T18:49:29Z")

</div>

Try forcing a version on the `httpClient` instance. I've seen HTTP servers that fail to negotiate down from HTTP 2 (the default used) to HTTP 1.

---

<div class="post-metadata">

**Author:** ![Cole\_Townsend](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cole_townsend/32/53149_2.png) [@Cole\_Townsend](https://forum.inductiveautomation.com/u/Cole_Townsend)\
**Post date:** [August 6, 2024, 6:50pm UTC](https://forum.inductiveautomation.com/t/http-client-connect-timeout-when-curl-command-on-same-device-works-with-the-same-endpoint/94244/4 "2024-08-06T18:50:14Z")

</div>

Might be a classic case of me mixing up scopes for project libraries again. Am I wrong in thinking that methods defined as a Scripting Project library do not carry gateway scope into the script console?

Would I need to have this method called from a gateway event instead to make it work?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 6, 2024, 6:50pm UTC](https://forum.inductiveautomation.com/t/http-client-connect-timeout-when-curl-command-on-same-device-works-with-the-same-endpoint/94244/5 "2024-08-06T18:50:51Z")

</div>

> [@Cole\_Townsend](#):
>
> Am I wrong in thinking that methods defined as a Scripting Project library do not carry gateway scope into the script console?

Yes. No? Not sure what you're asking.

Script libraries exist independently. They do nothing until something calls them. What that something is determines the scope.

---

<div class="post-metadata">

**Author:** ![Cole\_Townsend](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cole_townsend/32/53149_2.png) [@Cole\_Townsend](https://forum.inductiveautomation.com/u/Cole_Townsend)\
**Post date:** [August 6, 2024, 6:52pm UTC](https://forum.inductiveautomation.com/t/http-client-connect-timeout-when-curl-command-on-same-device-works-with-the-same-endpoint/94244/6 "2024-08-06T18:52:35Z")

</div>

Sorry, put a double negative in there. I incorrectly assumed the project library methods ran in gateway scope no matter where they were called from, was what I was saying. You answered my question.

I will try to get these to run with a gateway event instead. Thanks

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 6, 2024, 6:53pm UTC](https://forum.inductiveautomation.com/t/http-client-connect-timeout-when-curl-command-on-same-device-works-with-the-same-endpoint/94244/7 "2024-08-06T18:53:48Z")

</div>

Create a memory tag and put it in a tag change event script to test real quick.

If it works there, the issue is that the server your Gateway is running on can reach this device but the computer your Designer is running on can't.

If it also doesn't work there, then try what Paul suggested.

---

<div class="post-metadata">

**Author:** ![Cole\_Townsend](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cole_townsend/32/53149_2.png) [@Cole\_Townsend](https://forum.inductiveautomation.com/u/Cole_Townsend)\
**Post date:** [August 6, 2024, 6:57pm UTC](https://forum.inductiveautomation.com/t/http-client-connect-timeout-when-curl-command-on-same-device-works-with-the-same-endpoint/94244/8 "2024-08-06T18:57:22Z")

</div>

Fixed me up. Thanks Kevin.

My fault for continuing to mixup gateway/designer scope. Not the first time, probably not the last.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/0/903619e760e311b15fd9060af30cb731d975c9a8.png)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 6, 2024, 6:58pm UTC](https://forum.inductiveautomation.com/t/http-client-connect-timeout-when-curl-command-on-same-device-works-with-the-same-endpoint/94244/9 "2024-08-06T18:58:35Z")

</div>

No sweat, common mixup.

I think Paul wants to put some kind of "execution scope" dropdown into the script console one day, if we can figure out how to do it without it being a scary security nightmare.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 6, 2024, 7:01pm UTC](https://forum.inductiveautomation.com/t/http-client-connect-timeout-when-curl-command-on-same-device-works-with-the-same-endpoint/94244/10 "2024-08-06T19:01:47Z")

</div>

Pssst!

You may find my [@system.util.runInGateway](https://www.automation-pros.com/toolkit/doc/utility.html#runingateway) decorator helpful.

See also:

> [@Automation Professionals' Integration Toolkit Module](https://forum.inductiveautomation.com/t/automation-professionals-integration-toolkit-module/74934/122):
>
> Automation Professionals is pleased to announce a beta release of this Integration Toolkit: For Ignition v8.1+, as usual: v2.0.16.241352008 This beta introduces a number of new scripting features: Inspired by @Mathias_Melling above, the souped-up dictionary functionality of the BindableVarMap data type has been factored out, as [system.util.VarMap](https://www.automation-pros.com/toolkit/doc/scripting.html#varmap). Serializable to the extent its contents are serializable, just like dictionaries, and safe for use with persistence. grin The PythonAsJavaE…

---

<div class="post-metadata">

**Author:** ![Cole\_Townsend](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cole_townsend/32/53149_2.png) [@Cole\_Townsend](https://forum.inductiveautomation.com/u/Cole_Townsend)\
**Post date:** [August 6, 2024, 7:02pm UTC](https://forum.inductiveautomation.com/t/http-client-connect-timeout-when-curl-command-on-same-device-works-with-the-same-endpoint/94244/11 "2024-08-06T19:02:29Z")

</div>

That would be really cool/helpful!

I imagine you could piggy back off the designer roles system to deal with security. Maybe add a separate field for gateway scope access, or just use the 'save' field, since anyone with 'save' access can make changes to gateway scoped resources anyways.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/2/12ee39d0ac82625134586e83b31ffd1222d2e1d5.png)

I won't pretend to know what else it would impact though.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 6, 2024, 7:07pm UTC](https://forum.inductiveautomation.com/t/http-client-connect-timeout-when-curl-command-on-same-device-works-with-the-same-endpoint/94244/12 "2024-08-06T19:07:20Z")

</div>

It's not so much the user facing security that is an issue, it's the idea that we'd be adding an endpoint that literally did _remote code execution_, which is essentially the worst possible class of security vulnerability.

The existence of such an endpoint is scary to me. I'm afraid it would make it trivial for an attacker to pivot from auth bypass to RCE, rather than also needing to find an RCE vulnerability.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 6, 2024, 7:18pm UTC](https://forum.inductiveautomation.com/t/http-client-connect-timeout-when-curl-command-on-same-device-works-with-the-same-endpoint/94244/13 "2024-08-06T19:18:38Z")

</div>

> [@Kevin.Herron](#):
>
> The existence of such an endpoint is scary to me

The designer is one big auth bypass. I structured my `runInGateway` the way I did to ensure that any use would be _ **auditable** _ (project save required before the decorator works on a particular function), since you can't stop someone with designer access from actually doing Bad Things™.
