Reputation: 65
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.
Upvotes: 1
Views: 779
Reputation: 1919
Here's how to change an add-in created with yo office
, so its devServer
to uses http instead of https, so any fetch
to http end points won't result in mixed content.
In webpack.config.js:
server
value and use "http"
.
devServer: {
server: "http",
/*
server: {
type: "https",
options: env.WEBPACK_BUILD || options.https !== undefined ? options.https : await getHttpsOptions(),
},
*/
},
https://localhost:3000
with http://localhost:3000
.In manifest.xml:
https://localhost:3000
with http://localhost:3000
.In .vscode\launch.json:
https://localhost:3000
with http://localhost:3000
.Upvotes: 0
Reputation: 2791
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
Upvotes: 1