Sep 13, 2020 04:33 AM
Hi everyone,
This question might sound a bit naive and I apologize in advance. What is the best way to set up a proxy to a backend app in the scripting blocks dev environment?
When using create-react-app I make the proxy in the package.json
"proxy": {
"/api/projects": {
"target": "http://localhost:3000"
}
or more recently using http-proxy-middleware and creating a setupProxy.js on my src folder.
const { createProxyMiddleware } = require(‘http-proxy-middleware’);
module.exports = function (app) {
app.use(
'/api',
createProxyMiddleware({
target: 'http://localhost:3000',
changeOrigin: true,
})
);
};
I am not quite sure to set that when using the blocks. Thanks so much for your help!
Feb 25, 2022 11:09 AM
Mar 03, 2022 10:56 AM
Generally, you will use a proxy if your school or workplace provides it. You can also use a proxy to hide your IP address or access geo-blocked sites not available in your country.