I've been trying to use office API to fetch some data on office VPN. The fetch method is GET over HTTP protocol in the VPN. It fails. After some debugging, I've come to a question:
- is office script's fetch allowed to fetch HTTP protocol?
We don't have HTTPS and SSL as it is VPN so there is no encription needed. The only encryption that exists is between this office and the cloud via VPN client. My suspicion is that Microsoft feels this as unsafe and reject all HTTP protocol without SSL. Is this true?
What I've tried:
async function main(workbook: ExcelScript.Workbook) {
// Office Script fetch
// this is the official test url
const url0 = 'https://jsonplaceholder.typicode.com/todos/1'
// this is the FAIL fetch test (is it because HTTP?)
const urlFAIL = 'http://<localip>/api/collections/public/records';
// localhost works
const urlLocalhost = 'http://127.0.0.1/api/collections/public/records'
// this is SUCCESSFUL with the same API software! but this one is over internet with HTTPS
const urlSUCCESS = 'https://<someDNS>/api/collections/public/records';
console.log(url)
let fetchResult = await fetch(url0);
let json: object = await fetchResult.json();
console.log(JSON.stringify(json));
}
another thing is that I also tested in browser's fetch to the local IP: Everything works! even in HTTP. Somehow the HTTP does not work in office fetch.