[GH-ISSUE #1949] Assistance Installation: ENV / CORS issue #1264

Closed
opened 2026-02-22 18:23:59 -05:00 by yindo · 1 comment
Owner

Originally created by @QRMarketing on GitHub (Jul 24, 2024).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/1949

The package [anything-llm] looks good: but a rookie to it here. Perhaps some one can help me.

I got anything-llm installed on Windows 11 PC (not using Docker) and all seems to be working fine. With the following env:

SERVER_PORT=3001
JWT_SECRET="my-random-string-for-seeding" # Please generate random string at least 12 chars long.
SIG_KEY='passphrase' # Please generate random string at least 32 chars long.
SIG_SALT='salt' # Please generate random string at least 32 chars long.
STORAGE_DIR="C:\Users\user\Desktop\chat\anything-llm\server\storage"
VITE_API_BASE='http://localhost:3001/api'

What I am attempting to do is expose it to the public internet.

On my local router, I forwarded the NAT of the PC (port 3001) to my PC. This seems to be working fine.
I changed the env file with the following:

VITE_API_BASE='http://myip:3001/api'

The anything-llm starts up then just has a spinning loader. The console says:

2.4.241.25/:1 Access to fetch at 'http://localhost:3001/api/setup-complete' from origin 'http://myip:3001' has been blocked by CORS policy: The request client is not a secure context and the resource is in more-private address space local. index-563cf501.js:67 GET http://localhost:3001/api/setup-complete net::ERR_FAILED

At index-563cf501.js:67 on a debug break ${M} = "http://localhost:3001/api" which is obviously the CORS violation ->

keys: async function() {
return await fetch(${M}/setup-complete).then(e=>{
if (!e.ok)
throw new Error("Could not find setup information.");
return e.json()
}
).then(e=>e.results).catch(()=>null)
},

On line 65 of the server/index.js the debugger shows: process.env.NODE_ENV = undefined

TMP = 'C:\Users\User\AppData\Local\Temp'
USERDOMAIN = 'mypc name'
USERDOMAIN_ROAMINGPROFILE = 'mypc name'
USERNAME = 'User'
USERPROFILE = 'C:\Users\User'
VECTOR_DB = 'lancedb'
VITE_API_BASE = 'http://myip:3001/api'
VSCODE_INSPECTOR_OPTIONS = '{"inspectorIpc":"\\\\.\\pipe\\node-cdp.11124-1e073e07-.sock","deferredMode":false,"waitForDebugger":"","execPath":"C:\\ProgramFiles\\nodejs\\node.exe","onlyEntrypoint":false,"autoAttachMode":"always","openerId":"f31f3b4ad2afa9f418b29b19"}'
windir = 'C:\Windows'

So the server/index.js is seeing the new public/ip VITE_API_BAS values and not local. However, why is ${M} in the offending code showing local?

Clearly I am not understanding the env issues.
Any assistance or pointing me in the right direction is appreciated.

Originally created by @QRMarketing on GitHub (Jul 24, 2024). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/1949 The package [anything-llm] looks good: but a rookie to it here. Perhaps some one can help me. I got anything-llm installed on Windows 11 PC (not using Docker) and all seems to be working fine. With the following env: SERVER_PORT=3001 JWT_SECRET="my-random-string-for-seeding" # Please generate random string at least 12 chars long. SIG_KEY='passphrase' # Please generate random string at least 32 chars long. SIG_SALT='salt' # Please generate random string at least 32 chars long. STORAGE_DIR="C:\Users\user\Desktop\chat\anything-llm\server\storage" VITE_API_BASE='http://localhost:3001/api' What I am attempting to do is expose it to the public internet. On my local router, I forwarded the NAT of the PC (port 3001) to my PC. This seems to be working fine. I changed the env file with the following: VITE_API_BASE='http://myip:3001/api' The anything-llm starts up then just has a spinning loader. The console says: 2.4.241.25/:1 Access to fetch at 'http://localhost:3001/api/setup-complete' from origin 'http://myip:3001' has been blocked by CORS policy: The request client is not a secure context and the resource is in more-private address space `local`. index-563cf501.js:67 GET http://localhost:3001/api/setup-complete net::ERR_FAILED At index-563cf501.js:67 on a debug break ${M} = "http://localhost:3001/api" which is obviously the CORS violation -> keys: async function() { return await fetch(`${M}/setup-complete`).then(e=>{ if (!e.ok) throw new Error("Could not find setup information."); return e.json() } ).then(e=>e.results).catch(()=>null) }, On line 65 of the server/index.js the debugger shows: process.env.NODE_ENV = undefined TMP = 'C:\\Users\\User\\AppData\\Local\\Temp' USERDOMAIN = 'mypc name' USERDOMAIN_ROAMINGPROFILE = 'mypc name' USERNAME = 'User' USERPROFILE = 'C:\\Users\\User' VECTOR_DB = 'lancedb' VITE_API_BASE = 'http://myip:3001/api' VSCODE_INSPECTOR_OPTIONS = '{"inspectorIpc":"\\\\\\\\.\\\\pipe\\\\node-cdp.11124-1e073e07-.sock","deferredMode":false,"waitForDebugger":"","execPath":"C:\\\\ProgramFiles\\\\nodejs\\\\node.exe","onlyEntrypoint":false,"autoAttachMode":"always","openerId":"f31f3b4ad2afa9f418b29b19"}' windir = 'C:\\Windows' So the server/index.js is seeing the new public/ip VITE_API_BAS values and not local. However, why is ${M} in the offending code showing local? Clearly I am not understanding the env issues. Any assistance or pointing me in the right direction is appreciated.
yindo closed this issue 2026-02-22 18:23:59 -05:00
Author
Owner

@timothycarambat commented on GitHub (Jul 24, 2024):

This may help - you were on the right track
https://github.com/Mintplex-Labs/anything-llm/blob/61e214aa8c3f1cde6d6aa687a9310cf7f15e46cc/frontend/.env.example#L3

@timothycarambat commented on GitHub (Jul 24, 2024): This may help - you were on the right track https://github.com/Mintplex-Labs/anything-llm/blob/61e214aa8c3f1cde6d6aa687a9310cf7f15e46cc/frontend/.env.example#L3
yindo changed title from Assistance Installation: ENV / CORS issue to [GH-ISSUE #1949] Assistance Installation: ENV / CORS issue 2026-06-05 14:39:49 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#1264