bug fix for saving and restarting notebook

This commit is contained in:
JBB0807 2025-05-21 10:56:47 -07:00
parent 330baa51ac
commit eadf769ab3
4 changed files with 54 additions and 44 deletions

View file

@ -3,20 +3,22 @@ const api = require("express").Router();
const ASSIGNMENT_SERVICE_URL = process.env.ASSIGNMENT_SERVICE_URL;
// rerout to asisgnment url
api.use((req, res, next) => {
console.log(`Proxying request to: ${ASSIGNMENT_SERVICE_URL} : original url : ${req.originalUrl}`);
next();
});
api.use(
'/',
'/',
createProxyMiddleware({
target: ASSIGNMENT_SERVICE_URL,
changeOrigin: true,
logLevel: 'debug',
pathRewrite: {
'^/api': '', // only remove /api
'^/api': '', // remove "/api" from the start
},
onProxyReq(proxyReq, req, res) {
console.log(`Proxying request to: ${ASSIGNMENT_SERVICE_URL}${req.url}`);
},
onError(err, req, res) {
console.error('Proxy error:', err.message);
res.status(502).send('Bad Gateway: Failed to connect to target');
}
})
);