Scripted REST API - Control Use Of HTTP Proxy

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2024 07:24 PM - edited 07-01-2024 07:27 PM
When using a Scripted REST API, how can I control whether the REST call uses a HTTP Proxy at the MID Server?
Example
For some of my MID Servers, I must use a HTTP Proxy to make a REST call.
curl --proxy http://10.0.0.1:8080 https://management.azure.com
--> connects and gives results
curl https://management.azure.com
--> does not connect
For some of my MID Servers, I need not use a HTTP Proxy to make a REST call.
curl https://management.azure.com
--> connects and gives results
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2024 07:45 AM
Hello,
I think the best way would be to have 2 MID servers (or more): 1 with proxy enabled, 1 without proxy.
And then, when you script your REST call, you set the right MID server to be used:
- use the function setMidServer('midname') on your RestMessageV2
- or have the "Use MID Server" field set on your HTTP Method record if you have one
Reminder to set proxy on a MID server:
Set the following MID Server parameters (on the MID Server record):
- mid.proxy.use_proxy
Enables the MID Server to use a web proxy to access the ServiceNow instance.
- mid.proxy.host
Set this parameter to define the web proxy's host.
- mid.proxy.port
Set this parameter to define the web proxy's port.
- mid.proxy.username
If the web proxy requires a user name, set this parameter to define that username.
- mid.proxy.password
If the web proxy requires a password, set this parameter to define that password.
Regards,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2024 01:50 PM
Hello, @marcguegueniat ,
> I think the best way would be to have 2 MID servers (or more): 1 with proxy enabled, 1 without proxy.
Are you suggesting installing two or more MID Servers on the same Windows or Linux device? If so, that approach will not work.
If two or more MID Servers are on the same device, they both must share the same mid.proxy.* settings.
- If the device uses a HTTP proxy to access the internet, both MID Servers must have the mid.proxy.* settings configured to the correct HTTP proxy. Both MID Servers will connect to the ServiceNow instance via the HTTP proxy.
- If the device does not use a HTTP proxy to access the internet, both MID Servers must omit the mid.proxy.* settings. Both MID Servers will connect to the ServiceNow instance without using a HTTP proxy.
Since both MID Servers must use the same mid.proxy.* configuration, I cannot set one to use the mid.proxy.* settings and the other not to use the mid.proxy.* setttings.
I want to have a way to direct the Scripted REST API HTTP traffic independent of the mid-proxy.* settings. Is there any way to direct the Scripted REST API HTTP traffic independent of the mid.proxy.* settings?