# Gateway Event with system.net.httpGet error

**URL:** <https://forum.inductiveautomation.com/t/gateway-event-with-system-net-httpget-error/39330>\
**Category:** Ignition\
**Created:** [October 2, 2020, 8:37pm UTC](https://forum.inductiveautomation.com/t/gateway-event-with-system-net-httpget-error/39330 "2020-10-02T20:37:39Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![martinel3746](https://avatars.discourse-cdn.com/v4/letter/m/e0b2c6/32.png) [@martinel3746](https://forum.inductiveautomation.com/u/martinel3746)\
**Post date:** [October 2, 2020, 8:37pm UTC](https://forum.inductiveautomation.com/t/gateway-event-with-system-net-httpget-error/39330/1 "2020-10-02T20:37:39Z")

</div>

In Ignition 8.0.16 I have code that builds a URL then uses system.net.httpGet( url=siteUrl, headerValues=siteHeader.

It works when called from a script; it works when called from the Script Console; it works when I paste it into a browser (Chrome and Edge); it works in a MinGW64 session; it works when running directly on the Gateway Server and from my workstation.

When I call it in a Gateway Event script, specifically, via system.util.sendRequest, or in a Tag Event script, it generates the error:

**IOError: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target**

It errors even when I hard code the working URL directly in the Gateway Event script or Tag Event script.  
Is there a security setting or a bug that’s getting in the way?

I am moving the code from Ignition 7.9 where a tag event script calls a shared script (has been in production for 4 years now). I need to find a robust way for tag events in 8.x to both GET and POST to a web API and would prefer to have the script in a sharable location to be called from UDT tags.

I’m open to alternative solutions.

---

<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:** [October 2, 2020, 9:09pm UTC](https://forum.inductiveautomation.com/t/gateway-event-with-system-net-httpget-error/39330/2 "2020-10-02T21:09:03Z")

</div>

For a variety of reasons, I evangelize [`system.net.httpClient`](https://docs.inductiveautomation.com/display/DOC80/system.net.httpClient) pretty heavily, but (aside from the `bypass_cert_validation` flag) it’s not the solution to your issue as it stands.  
The path validation exception indicates to me that your IT group might be loading a custom root certificate at the OS level - that would be why browsers, consoles, etc can hit it, and you can even hit it from inside the designer - but the gateway host may not have that custom cert loaded.

---

<div class="post-metadata">

**Author:** ![martinel3746](https://avatars.discourse-cdn.com/v4/letter/m/e0b2c6/32.png) [@martinel3746](https://forum.inductiveautomation.com/u/martinel3746)\
**Post date:** [October 2, 2020, 9:37pm UTC](https://forum.inductiveautomation.com/t/gateway-event-with-system-net-httpget-error/39330/3 "2020-10-02T21:37:07Z")

</div>

Actually, I can hit it from the Gateway Host - at least I think I can.  
When I use a Remote Desktop login and run the Designer on the Gateway, it still works in script, browser and script console.  
These API calls were working on the same server before upgrading from 7.9 to 8.0.  
The OS and server configuration is the same but the version of Ignition is different.

---

<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:** [October 2, 2020, 11:02pm UTC](https://forum.inductiveautomation.com/t/gateway-event-with-system-net-httpget-error/39330/4 "2020-10-02T23:02:53Z")

</div>

So from 7.9 -\> 8.0 we stopped using the system’s Java and started using our own. It’s got its own cert chain embedded, so it’s possible:

1. Something like what I first suggested happened, so Java’s not aware that it should ‘trust’ your bespoke cert.
2. Your service is behind an expired/outdated/etc cert, and Java isn’t trusting it while internals are. That’s less likely, because browsers really don’t like outdated certs, but theoretically possible.

---

<div class="post-metadata">

**Author:** ![martinel3746](https://avatars.discourse-cdn.com/v4/letter/m/e0b2c6/32.png) [@martinel3746](https://forum.inductiveautomation.com/u/martinel3746)\
**Post date:** [October 6, 2020, 7:48pm UTC](https://forum.inductiveautomation.com/t/gateway-event-with-system-net-httpget-error/39330/5 "2020-10-06T19:48:30Z")

</div>

**It is working now by doing the following:**

1. Pasted the URL into the browser address bar
2. Clicked on the security icon (padlock) to see the certificate in use
3. Exported the certificate file
4. Copied the certificate file to:  
C:\Program Files\Inductive Automation\Ignition\data\certificates\supplemental
5. Restarted the Ignition service

---

<div class="post-metadata">

**Author:** ![Keith\_Stevens](https://avatars.discourse-cdn.com/v4/letter/k/76d3ee/32.png) [@Keith\_Stevens](https://forum.inductiveautomation.com/u/Keith_Stevens)\
**Post date:** [July 27, 2023, 1:57pm UTC](https://forum.inductiveautomation.com/t/gateway-event-with-system-net-httpget-error/39330/6 "2023-07-27T13:57:42Z")

</div>

I am getting the same TLS certificate error message after exporting it using a web browser and copying that file into C:\Program Files\Inductive Automation\Ignition\data\certificates\supplemental and restarting the service, I'm still getting the error. Any ideas?

---

<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:** [July 27, 2023, 2:16pm UTC](https://forum.inductiveautomation.com/t/gateway-event-with-system-net-httpget-error/39330/7 "2023-07-27T14:16:00Z")

</div>

If it’s a CA signed certificate (i.e. a chain), and not a single self signed certificate, it’s the _root_ certificate you need to import.

What scope is the http call being made from?

---

<div class="post-metadata">

**Author:** ![Keith\_Stevens](https://avatars.discourse-cdn.com/v4/letter/k/76d3ee/32.png) [@Keith\_Stevens](https://forum.inductiveautomation.com/u/Keith_Stevens)\
**Post date:** [July 27, 2023, 2:45pm UTC](https://forum.inductiveautomation.com/t/gateway-event-with-system-net-httpget-error/39330/8 "2023-07-27T14:45:25Z")

</div>

Kevin,  
Currently its a perspective button press event script:  
def runAction(self, event):  
url = "[https://grevlablnk.nrb.inside/#!/](https://grevlablnk.nrb.inside/#!/)"  
myClient = system.net.httpClient()  
response = myClient.get(url)  
system.perspecitve.print(response)

If that's what you're asking regarding scope.  
I don't know for certain where the certificate on the LabLink API server comes from but the IP address of it private so I think it may be self signed certificate. I'll ask that question. In fact I'm just going to add another email to the CC on this.  
Elias,  
please note Kevins response in this chain.

Keith

---

<div class="post-metadata">

**Author:** ![Keith\_Stevens](https://avatars.discourse-cdn.com/v4/letter/k/76d3ee/32.png) [@Keith\_Stevens](https://forum.inductiveautomation.com/u/Keith_Stevens)\
**Post date:** [August 17, 2023, 4:05pm UTC](https://forum.inductiveautomation.com/t/gateway-event-with-system-net-httpget-error/39330/9 "2023-08-17T16:05:15Z")

</div>

finally got the root cert put in that directory and the SSL error is gone. Thanks.
