Proxy to Strapi admin panel using Node.js

I created a node.js server to host my Vue 3 front end and can successfully get data from the Strapi /api calls after allowing permission. What I can’t seem to do is get the admin panel to work using a proxy. This is what I am trying to do with node. The app.get works just fine for the data API. The admin does not work.

app.get('/api/*', (req, res) => {
  proxy.web(req, res, { target: `http://localhost:1337${req.url}` })

app.all('/admin*', (req, res) => {
    proxy.web(req, res, { target: `http://localhost:1337/admin` })

It works in that it sends me directly to the register route http://localhost:3000/admin/auth/register-admin

If I try to get to /auth/login, it immediately redirects me back to the register route. Is it possible to use the service through a proxy in Node like I am attempting to do? No matter how I modify including trying to get it to send me directly to /admin/auth/login, it still redirects me back to register.

System Information
  • Strapi Version: Latest
  • Operating System: Windows 11
  • Database:
  • Node Version: 20
  • NPM Version:
  • Yarn Version:

I solved the issue. Here is what I did to get my static host server to serve my Vue front end and also be linked to my Strapi back end which I have running locally on the same network and not exposed to the internet directly.

const express = require('express');
const httpProxy = require('http-proxy');
const path = require('path');

const app = express();
const proxy = httpProxy.createProxyServer();

// Serve static files from the Vue.js frontend
const staticFilesBaseRoute = ['/', '/index.html']; // Add more routes if needed
app.use(staticFilesBaseRoute, express.static(path.join(__dirname, 'front-end')));

// Proxy all other requests to the Strapi backend
app.all('*', (req, res) => {
    proxy.web(req, res, { target: 'http://localhost:1337' });

// Handle proxy errors
proxy.on('error', (err, req, res) => {
    console.error('Proxy error:', err);
    res.status(500).send('Proxy error');

I have no idea so far if this is a bad approach or use of Strapi, but it works.