diff --git a/packages/server/src/controllers/ip/index.ts b/packages/server/src/controllers/ip/index.ts deleted file mode 100644 index 6775f9f5..00000000 --- a/packages/server/src/controllers/ip/index.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Request, Response, NextFunction } from 'express' -import { InternalFlowiseError } from '../../errors/internalFlowiseError' -import { StatusCodes } from 'http-status-codes' - -// Configure number of proxies in Host Environment -const configureProxyNrInHostEnv = async (req: Request, res: Response, next: NextFunction) => { - try { - if (typeof req.ip === 'undefined' || req.ip) { - throw new InternalFlowiseError( - StatusCodes.PRECONDITION_FAILED, - `Error: ipController.configureProxyNrInHostEnv - ip not provided!` - ) - } - const apiResponse = { - ip: req.ip, - msg: `Check returned IP address in the response. If it matches your current IP address ( which you can get by going to http://ip.nfriedly.com/ or https://api.ipify.org/ ), then the number of proxies is correct and the rate limiter should now work correctly. If not, increase the number of proxies by 1 and restart Cloud-Hosted Flowise until the IP address matches your own. Visit https://docs.flowiseai.com/configuration/rate-limit#cloud-hosted-rate-limit-setup-guide for more information.` - } - return res.send(apiResponse) - } catch (error) { - next(error) - } -} - -export default { - configureProxyNrInHostEnv -} diff --git a/packages/server/src/index.ts b/packages/server/src/index.ts index 4862363e..42b1947f 100644 --- a/packages/server/src/index.ts +++ b/packages/server/src/index.ts @@ -149,6 +149,16 @@ export class App { this.app.use('/api/v1', flowiseApiV1Router) + // ---------------------------------------- + // Configure number of proxies in Host Environment + // ---------------------------------------- + this.app.get('/api/v1/ip', (request, response) => { + response.send({ + ip: request.ip, + msg: 'Check returned IP address in the response. If it matches your current IP address ( which you can get by going to http://ip.nfriedly.com/ or https://api.ipify.org/ ), then the number of proxies is correct and the rate limiter should now work correctly. If not, increase the number of proxies by 1 and restart Cloud-Hosted Flowise until the IP address matches your own. Visit https://docs.flowiseai.com/configuration/rate-limit#cloud-hosted-rate-limit-setup-guide for more information.' + }) + }) + // ---------------------------------------- // Serve UI static // ---------------------------------------- diff --git a/packages/server/src/routes/index.ts b/packages/server/src/routes/index.ts index 8b5a57b0..3382dba8 100644 --- a/packages/server/src/routes/index.ts +++ b/packages/server/src/routes/index.ts @@ -13,7 +13,6 @@ import fetchLinksRouter from './fetch-links' import flowConfigRouter from './flow-config' import internalChatmessagesRouter from './internal-chat-messages' import internalPredictionRouter from './internal-predictions' -import ipRouter from './ip' import getUploadFileRouter from './get-upload-file' import getUploadPathRouter from './get-upload-path' import loadPromptRouter from './load-prompts' @@ -54,7 +53,6 @@ router.use('/fetch-links', fetchLinksRouter) router.use('/flow-config', flowConfigRouter) router.use('/internal-chatmessage', internalChatmessagesRouter) router.use('/internal-prediction', internalPredictionRouter) -router.use('/ip', ipRouter) router.use('/get-upload-file', getUploadFileRouter) router.use('/get-upload-path', getUploadPathRouter) router.use('/load-prompt', loadPromptRouter) diff --git a/packages/server/src/routes/ip/index.ts b/packages/server/src/routes/ip/index.ts deleted file mode 100644 index 04de7818..00000000 --- a/packages/server/src/routes/ip/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -import express from 'express' -import ipController from '../../controllers/ip' -const router = express.Router() - -// CREATE - -// READ -router.get('/', ipController.configureProxyNrInHostEnv) - -// UPDATE - -// DELETE - -export default router