Skip to content

Instantly share code, notes, and snippets.

@rmeissner
Last active September 9, 2020 08:48
Show Gist options
  • Save rmeissner/b66f8350c4a6b8d077007f86a9e5187c to your computer and use it in GitHub Desktop.
Save rmeissner/b66f8350c4a6b8d077007f86a9e5187c to your computer and use it in GitHub Desktop.
Run Safe apps locally
  • Add .env.development with
HTTPS=true
PORT=3002
  • Add http-proxy-middleware
yarn add http-proxy-middleware
  • Add setupProxy.js in ./src with
const { createProxyMiddleware } = require('http-proxy-middleware');
module.exports = function(app) {
  app.use(
    '/sapp',
    createProxyMiddleware({
      target: 'https://localhost:3002',
      changeOrigin: true,
      secure: false,
      onProxyRes: (proxyRes, req, res) => {
        Object.assign(proxyRes.headers, {
            "Access-Control-Allow-Origin": "\*",
            "Access-Control-Allow-Methods": "GET",
            "Access-Control-Allow-Headers": "X-Requested-With, content-type, Authorization"
        })
      },
      pathRewrite: (path) => path.replace("/sapp/", "/"),
    })
  );
};
  • Add Safe app in rinkeby.gnosis-safe.io/#/app with https://localhost:3002/sapp/ (make sure to add the / at the end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment