Remote ctrlX Core Access 2.jpg

Remote Access for ctrlX CORE via Internet

Sgilk
Frequent Contributor
Introduction

In this article, a method of exposing a ctrlX CORE to be accessed over the internet is explained. Specifically, the use case of a REST API endpoint hosted in Node-Red is covered. A Netgear RAX45 router is used in this example, but the same principles apply to all devices. 

Prerequisites

An understanding of REST API methods will be useful in following this example. The specifics behind the structure of requests are not explained.

Useful Links

Using REST API of ctrlX CORE

Node-Red Communication Methods

Instruction
Step 1: Port Forwarding Configuration

In order to to access the Node-Red flow editor of a ctrlX CORE on a seperate network, port forwarding rules should be configured in the router. The ctrlX CORE is a network participant, so all external traffic must be forwarded to the CORE, through the router which has an internet connection. The ctrlX CORE web interface and Node-Red application run on the HTTPS port. This is the internal port in the port forwarding rule configuration and is 443 by default. The external port can be chosen by the user, so long as it is not already in use by another application. In this example, 55555 is provided as the external port. The internal IP address on the CORE local area network must also be included in the rule. A single port is forwarded in this case, but a range could be used as well.

ctrlX Core Port Forwarding 2.png

Once this port is forwarded, the ctrlX CORE web interface and Node-Red flow editor should be accessible from a seperate network via the internet. The URL to access the web interface can be built as shown below.

 https://{External IP Address}:{External Port}

To find the external IP address of the router, a web page like the following can be used: https://myexternalip.com/

Step 2: Create Node-Red REST API Endpoint

To create an endpoint that will accept writing over REST API POST request, use an HTTP In node and set the method to POST. The URL is user choice and will set the endpoint address. In this example, the endpoint URL is then:  

https://{External IP Address}:{External Port}/node-red/Example-Endpoint

Node Red HTTP In Config.png

Now, the endpoint should accept a POST request from an external source, so long as the sender accepts self signed certificates. The request below was configured in Postman. 

Postman Post Request.png

The image below shows the data arriving at the endpoint in Node-Red. A response to the request is also sent back to the sender to indicate the successful operation. The flow is attached as type .txt at the bottom of the article.

Node Red HTTP Endpoint.png

Other endpoints on the ctrlX CORE datalayer can also be written to and read from using this method (e.g. PLC variables), with proper authentication. Please reference the first useful link for further information on this topic.

Downloads
Sgilk
Sgilk
Hello, my name is Sam and I am a Software Applications Engineer supporting ctrlX Automation. Feel free to reach out if you have any questions!
1 Comment
Must Read
Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist