Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the port the client proxy proxies to configurable #346

Merged
merged 11 commits into from
May 9, 2024
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,19 @@ Alternatively you can spin up a mock instance of the admin ui with:
This uses mock data instead of a real Opencast. This means certain features will
not work when using this mode.

### Alternative ports

The static file server and the proxy server serve their content
on the port 5000. If this is used already (as it is on macOS)
you can specify an alternative port in the `PORT` environment variable,
for example:

PORT=5001 npm run proxy-server ...

Note that you need to specify the same port when running the client,
this time in the `PROXY_PORT` variable:

PROXY_PORT=5001 npm run client

How to cut a release for Opencast
---------------------------------
Expand Down Expand Up @@ -111,4 +123,4 @@ Configuration
-------------
The Admin UI frontend cannot be directly configured. Rather, it adapts to the
various configurations in the Opencast backend. TODO: Throw in some links to the
docs, which ones?
docs, which ones?
174 changes: 20 additions & 154 deletions app/src/setupProxy.js
Original file line number Diff line number Diff line change
@@ -1,157 +1,23 @@
const { createProxyMiddleware } = require("http-proxy-middleware");

const port = process.env.PROXY_PORT || 5000;

module.exports = function (app) {
app.use(
"/admin-ng/event/new/conflicts",
createProxyMiddleware({
target: "http://localhost:5000",
changeOrigin: true,
})
);
app.use(
"/admin-ng",
createProxyMiddleware({
target: "http://localhost:5000",
changeOrigin: true,
})
);
app.use(
"/acl-manager",
createProxyMiddleware({
target: "http://localhost:5000",
changeOrigin: true,
})
);
app.use(
"/i18n",
createProxyMiddleware({
target: "http://localhost:5000",
changeOrigin: true,
})
);
app.use(
"/i18n",
createProxyMiddleware({
target: "http://localhost:5000",
changeOrigin: true,
})
);
app.use(
"/blacklist",
createProxyMiddleware({
target: "http://localhost:5000",
changeOrigin: true,
})
);
app.use(
"/capture-agents",
createProxyMiddleware({
target: "http://localhost:5000",
changeOrigin: true,
})
);
app.use(
"/email",
createProxyMiddleware({
target: "http://localhost:5000",
changeOrigin: true,
})
);
app.use(
"/groups",
createProxyMiddleware({
target: "http://localhost:5000",
changeOrigin: true,
})
);
app.use(
"/info",
createProxyMiddleware({
target: "http://localhost:5000",
changeOrigin: true,
})
);
app.use(
"/roles",
createProxyMiddleware({
target: "http://localhost:5000",
changeOrigin: true,
})
);
app.use(
"/services",
createProxyMiddleware({
target: "http://localhost:5000",
changeOrigin: true,
})
);
app.use(
"/sysinfo",
createProxyMiddleware({
target: "http://localhost:5000",
changeOrigin: true,
})
);
app.use(
"/workflow",
createProxyMiddleware({
target: "http://localhost:5000",
changeOrigin: true,
})
);
app.use(
"/img",
createProxyMiddleware({
target: "http://localhost:5000",
changeOrigin: true,
})
);
app.use(
"/app/styles",
createProxyMiddleware({
target: "http://localhost:5000",
changeOrigin: true,
})
);
app.use(
"/staticfiles",
createProxyMiddleware({
target: "http://localhost:5000",
changeOrigin: true,
})
);
app.use(
"/public",
createProxyMiddleware({
target: "http://localhost:5000",
changeOrigin: true,
})
);
app.use(
"/modules",
createProxyMiddleware({
target: "http://localhost:5000",
changeOrigin: true,
})
);
app.use(
"/shared",
createProxyMiddleware({
target: "http://localhost:5000",
changeOrigin: true,
})
);
app.use(
"/j_spring_security_check",
createProxyMiddleware({
target: "http://localhost:5000",
changeOrigin: true,
})
);
app.use(
"/ui",
createProxyMiddleware({
target: "http://localhost:5000",
changeOrigin: true,
})
);
app.use(
[
"/api",
"/admin-ng",
"/acl-manager",
"/info",
"/services",
"/sysinfo",
"/staticfiles",
"/j_spring_security_check",
"/ui",
],
createProxyMiddleware({
target: `http://localhost:${port}`,
changeOrigin: true,
}),
);
};
Loading
Loading