mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-29 05:01:10 +03:00
@@ -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
|
|
||||||
}
|
|
||||||
@@ -149,6 +149,16 @@ export class App {
|
|||||||
|
|
||||||
this.app.use('/api/v1', flowiseApiV1Router)
|
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
|
// Serve UI static
|
||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import fetchLinksRouter from './fetch-links'
|
|||||||
import flowConfigRouter from './flow-config'
|
import flowConfigRouter from './flow-config'
|
||||||
import internalChatmessagesRouter from './internal-chat-messages'
|
import internalChatmessagesRouter from './internal-chat-messages'
|
||||||
import internalPredictionRouter from './internal-predictions'
|
import internalPredictionRouter from './internal-predictions'
|
||||||
import ipRouter from './ip'
|
|
||||||
import getUploadFileRouter from './get-upload-file'
|
import getUploadFileRouter from './get-upload-file'
|
||||||
import getUploadPathRouter from './get-upload-path'
|
import getUploadPathRouter from './get-upload-path'
|
||||||
import loadPromptRouter from './load-prompts'
|
import loadPromptRouter from './load-prompts'
|
||||||
@@ -54,7 +53,6 @@ router.use('/fetch-links', fetchLinksRouter)
|
|||||||
router.use('/flow-config', flowConfigRouter)
|
router.use('/flow-config', flowConfigRouter)
|
||||||
router.use('/internal-chatmessage', internalChatmessagesRouter)
|
router.use('/internal-chatmessage', internalChatmessagesRouter)
|
||||||
router.use('/internal-prediction', internalPredictionRouter)
|
router.use('/internal-prediction', internalPredictionRouter)
|
||||||
router.use('/ip', ipRouter)
|
|
||||||
router.use('/get-upload-file', getUploadFileRouter)
|
router.use('/get-upload-file', getUploadFileRouter)
|
||||||
router.use('/get-upload-path', getUploadPathRouter)
|
router.use('/get-upload-path', getUploadPathRouter)
|
||||||
router.use('/load-prompt', loadPromptRouter)
|
router.use('/load-prompt', loadPromptRouter)
|
||||||
|
|||||||
@@ -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
|
|
||||||
Reference in New Issue
Block a user