1

I am calling an http endpoint using axios in an excel addin project. However I am unable to call the endpoint because the addin has an https certificate. It gets installed on every project I try to create using the addin cli. Is there a way to disable https so I can call this endpoint? Here is the error.

Mixed Content: The page at 'https://localhost:3000/taskpane.html?_host_Info=####'
was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint
'http://#######'. This request has been blocked;
the content must be served over HTTPS.
jalwan
  • 55
  • 10

1 Answers1

1

First, your question is missing an important detail that I was able to derive, but you should have included, your using NodeJS as your server.

This isn't technically a duplicate, but the question is really How to disable SSL in NodeJS, Yeoman Office-JS Template as it seems you have already figured out you can't call an http endpoint from an SSL enabled Office Add-In.

I'm not 100% how to disable SSL in NodeJS, but try changing the Dev URL to http. In webpack.config.js --> const urlDev = "https://localhost:3000/"; --> const urlDev = "http://localhost:3000/";.

If you have access to the backend server and can get SSL configured, your better off setting up a API Gateway/Proxy such as krakend to proxy http requests.

I know I just had to disable SSL in my project for the same reason, but I use Visual Studio, so I can't test NodeJS.

See --> https://stackoverflow.com/a/71461455/5079799

FreeSoftwareServers
  • 2,271
  • 1
  • 33
  • 57
  • I could not disable SSL by changing urlDev on the webpack config file. Managed to set up krakend with a self signed cert, but I now I get this error "xhr.js:210 GET https://localhost:8080/v1/info/#### net::ERR_CERT_AUTHORITY_INVALID" I am able to curl and get a response from the krakend endpoint but I cant call from the excel addin. – jalwan Mar 15 '22 at 10:10
  • I do not have access to the backend server. I ran krakend locally using docker. I guess i'll try disabling https for the nodejs server. Thanks. – jalwan Mar 15 '22 at 10:13
  • Did you import the cert into your local trusted store? When setting up KrakenD I used Insomnia to test the API for SSL Errors outside of office-js. But, for simplicity, you should be able to disable SSL on Node for testing. I know it was easy in Visual Studio which I much prefer over NodeJS for the solution explorer and JS console. See here --> https://stackoverflow.com/a/70736058/5079799 – FreeSoftwareServers Mar 15 '22 at 18:16
  • I basically merged a VS 2022 template w/ a VS 2017 template. stripped the VS template all together and use the yo office files in VS. Each time I build via `npm run build` then start my project, but this allows `polyfill` which isn't part of the VS templates. – FreeSoftwareServers Mar 15 '22 at 18:17
  • I've debated releasing a project scaffold on `git` but not 100% I can license wise? – FreeSoftwareServers Mar 15 '22 at 18:18