You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We would like to load additional local resources when using the server, but it seems that only the "server" section of the configuration is used while starting the server. During the actual HTTP requests, nothing in "customCode" is applied. Is this the case due to security reasons or is this feature not complete yet?
The text was updated successfully, but these errors were encountered:
I found a workaround that works for my use case: In addition to highcharts-export-server I start an express server that is able to serve my JS files and only binds to localhost. I then use the scripts section of the node-export-server config to load the scripts.
Here's my express server code:
constexpress=require('express')constcors=require('cors');require('dotenv').config()constapp=express()constport=process.env.HC_STATIC_PORT||3000app.use(cors({origin: '*'// We need CORS headers because otherwise the Pupeteer browser instance will block the files. Using localhost as origin doesn't work. Since we only bind to localhost * should be ok}));app.use(express.static('static'))app.listen(port,'localhost',()=>{console.log(`Highcharts Node.js export server static file app listening on port ${port}`)})
One important side note: the scripts are combined and cached. If you change them the cached version is not updated. You need to delete node_modules/highcharts-export-server/.cache to update the scripts. Also don't forget to add moment and lodash to the scripts section, because it's there by default, but if you define it it's overwritten.
If you need to load CSS files it's possible to also host them locally using the express server and then load them through JavaScript using the customCode request parameter.
We would like to load additional local resources when using the server, but it seems that only the "server" section of the configuration is used while starting the server. During the actual HTTP requests, nothing in "customCode" is applied. Is this the case due to security reasons or is this feature not complete yet?
The text was updated successfully, but these errors were encountered: