-
Notifications
You must be signed in to change notification settings - Fork 24
Using the SDK through a proxy
Many organizations use a proxy to restrict/control HTTP requests made from within their organization, including to your https://{domain}.aquaticinformatics.net app server.
The SDK supports a number of ways of working with proxies, so that your integrations can still communicate through the proxy to your AQTS app server.
The term "proxy" can be a bit nebulous.
These types of proxies often work automatically with SDK integrations, without any special configuration requied.
These procies can intercept web requests from processes on that machine, or just from processes in the same user session.
When Fiddler is run on a client system, it will automatically capture all the request traffic from an application built with the Aquarius SDK. See the Capture your HTTP traffic section for details.
This is how almost all the API-based integrations are developed for AI Source. We just launch Fiddler in the background, then just run the SDK-based code. Fiddler automatically intercepts the requests and allows me to inspect both the request and response messages.
Here is a Fiddler screenshot automatically capturing a PointZilla session that appends some points to an app server. It works automaticall because both Fiddler.exe and PointZilla.exe are running within the same user account on the development PC.
A proxy could be running somewhere else within the corporate network. These can be more finicky to configure.
Often these corporate proxy systems are much more finicky to deal with. And there are many different corporate proxy vendors, and each of them are configured differently.
Many corporate proxies can to told to use the User-Agent header to determine if a connection is allowed as one of their lockdown rules.
Take a look at the User-Agent header in the top right corner of the Fiddler screenshot.
ServiceStack .NET Client 5.104/Aquarius.Client 21.2.3.0/PointZilla 1.0.394
This header value is automatically set by the SDK to contain the name and version of the SDK used by the program (ServiceStack .NET Client 5.104/Aquarius.Client 21.2.3.0
in this case) and the name and version of the program that consumes the SDK (PointZilla 1.0.394
in this case).
Let’s assume your integration consuming the Aquarius SDK is a program is called TelemetryFeed.exe and that Susan is trying to run that program to get her work done.
When Susan runs TelemetryFeed.exe it will make requests to https://yourorg.aquaticinformatics.net/AQUARIUS with a User-Agent like ServiceStack .NET Client 5.104/Aquarius.Client 21.2.3.0/TelemetryFeed w.x.y.z
(depending on which version of the SDK was used).
A corporate proxy might intercept the request and might say “that user-agent isn’t one of the allowed programs” (ie it doesn’t look like a browser user agent string from Chrome/Edge/Firefox/Safari) and deny the request.
If your IT department can configure the proxy to allow requests containing the ServiceStack */Aquarius.Client*
user agent pattern, then your integrations (and any tools downloaded from http://source.aquaticinformatics.com) will automatically be routed through the proxy.
You can manually configure any .NET application’s config file (yourappname.exe.config) by adding a <defaultProxy>
node in the <system.net>
section of the <configuration>
area.
So that might mean editing TelemetryFeed.exe.config
to be something like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.net>
<defaultProxy>
<proxy autoDetect="false" bypassonlocal="false" proxyaddress="http://127.0.0.1:8888/" usesystemdefault="false" />
</defaultProxy>
</system.net>
</configuration>
There are quite a few different settings for proxies, so there might be some trial and error involved.
C# and VB.NET code can also set a global proxy for the .NET process, before any SDK calls are made (including the AquariusClient.CreateConnectedClient() method), and the SDK will use that configured proxy for all of its requests.
Something like this should do the trick:
// This sets a global proxy for the entire process, including all subsequent requests made by the SDK
GlobalProxySelection.Select = new WebProxy("http://webproxy:80/");
using(var client = AquariusClient.CreateConnectedClient("https://yourorg.aquaticinformatics.net", "me", "sekret"))
{
// Make API requests using the SDK ...
}
MSDN has some decent starting places to look into.
Still have questions? Feel free to raise an issue or contact our Support Team
- SDK design philosophy
- AQTS client concepts
- AQTS code examples
- Finding the unique ID of a time-series
- Creating a time-series
- Creating a derived time-series
- Appending points to a basic time-series
- Appending points to a reflected time-series
- Monitoring changes to a time-series
- Retrieving all the locations on an AQTS server
- Uploading an external report
- Downloading a visit or location attachment
- VB.NET Support
- Troubleshooting tips
- AQSamples client concepts