mirror of
https://github.com/fosrl/pangolin.git
synced 2025-12-18 14:05:33 +00:00
Adjust rate limiting position
This commit is contained in:
@@ -79,6 +79,12 @@ export function createApiServer() {
|
|||||||
// Add request timeout middleware
|
// Add request timeout middleware
|
||||||
apiServer.use(requestTimeoutMiddleware(60000)); // 60 second timeout
|
apiServer.use(requestTimeoutMiddleware(60000)); // 60 second timeout
|
||||||
|
|
||||||
|
apiServer.use(logIncomingMiddleware);
|
||||||
|
|
||||||
|
if (build !== "oss") {
|
||||||
|
apiServer.use(`${prefix}/hybrid`, hybridRouter); // put before rate limiting because we will rate limit there separately because some of the routes are heavily used
|
||||||
|
}
|
||||||
|
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
apiServer.use(
|
apiServer.use(
|
||||||
rateLimit({
|
rateLimit({
|
||||||
@@ -101,11 +107,7 @@ export function createApiServer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// API routes
|
// API routes
|
||||||
apiServer.use(logIncomingMiddleware);
|
|
||||||
apiServer.use(prefix, unauthenticated);
|
apiServer.use(prefix, unauthenticated);
|
||||||
if (build !== "oss") {
|
|
||||||
apiServer.use(`${prefix}/hybrid`, hybridRouter);
|
|
||||||
}
|
|
||||||
apiServer.use(prefix, authenticated);
|
apiServer.use(prefix, authenticated);
|
||||||
|
|
||||||
// WebSocket routes
|
// WebSocket routes
|
||||||
|
|||||||
@@ -227,6 +227,8 @@ export type UserSessionWithUser = {
|
|||||||
export const hybridRouter = Router();
|
export const hybridRouter = Router();
|
||||||
hybridRouter.use(verifySessionRemoteExitNodeMiddleware);
|
hybridRouter.use(verifySessionRemoteExitNodeMiddleware);
|
||||||
|
|
||||||
|
// TODO: ADD RATE LIMITING TO THESE ROUTES AS NEEDED BASED ON USAGE PATTERNS
|
||||||
|
|
||||||
hybridRouter.get(
|
hybridRouter.get(
|
||||||
"/general-config",
|
"/general-config",
|
||||||
async (req: Request, res: Response, next: NextFunction) => {
|
async (req: Request, res: Response, next: NextFunction) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user