ragflow icon indicating copy to clipboard operation
ragflow copied to clipboard

how to deploy the web server on http://mydomain.com/ragflow

Open pamdla opened this issue 10 months ago • 7 comments

I tried to modify nginx conf like that:

location /ragflow/ {

proxy_pass http://127.0.0.1:8000/

proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_buffering off;
proxy_read_timeout 3600s;
proxy_send_timeout 3600s;

}

But, the browser displayed an empty page with errors:

http://mydomain.com/umi.51e26180.css 404 not found
http://mydomain.com/umi.01611ea0.js 404 not found

except that, everything is ok if I disable nginx, and I can view http://mydomain.com/ and it redirected to http://mydomain.com/login.

I want to use http://mydomain.com/ragflow , because i have another service http://mydomain.com/default opened up on the port 80, and I need both applications work under mydomain.

any help?

pamdla avatar Apr 16 '25 03:04 pamdla

I found a similar open issue that might be relevant to your problem: [Question]: build nginx proxy [1]. However, it doesn't have any comments or solutions yet.

To resolve the 404 errors for CSS and JS files when deploying the web server on http://mydomain.com/ragflow, you can modify your Nginx configuration as follows:

server {
    listen 80;
    server_name mydomain.com;

    location /ragflow/ {
        alias /ragflow/web/dist/;
        index index.html;
        try_files $uri $uri/ /ragflow/index.html;
    }

    location /default/ {
        proxy_pass http://localhost:YOUR_DEFAULT_SERVICE_PORT;
        include proxy.conf;
    }

    location ~ ^/ragflow/static/(css|js|media)/ {
        alias /ragflow/web/dist/static/$1/;
        expires 10y;
        access_log off;
    }
}

Key Changes:

  • alias: Use alias in the /ragflow/ location to map the path to the correct directory.
  • try_files: Ensure it points to /ragflow/index.html to handle routing correctly.
  • Static Files: Serve static files correctly by using alias to map to the correct directory structure.

Make sure to replace YOUR_DEFAULT_SERVICE_PORT with the actual port number where your default service is running. This configuration should help avoid 404 errors for CSS and JS files by correctly mapping the paths [2].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

dosubot[bot] avatar Apr 16 '25 03:04 dosubot[bot]

not work

pamdla avatar Apr 16 '25 03:04 pamdla

I also have the same problem, I use http:// a: 80/login can access the interface, but if I configure nginx on another service and want to proxy a, there will be a problem. I want to access http:// b: 17001/my-rag-v1/login can proxy access to http:// a:80/login, But I found that umi.83fcea4e.js automatically generates some JS files that it cannot access. Here is my nginx configuration

 upstream my-rag-server {
        server *.*.*.*:9280 fail_timeout=2s;
    }

    server {
        listen 17001;
        server_name *.*.*.*;

        access_log /root/access.log;
        error_log /root/access.log warn;

        location ^~/my-rag {
            proxy_pass http://my-rag-server;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_pass_header Content-Type;
        }
    }

robben009 avatar Apr 16 '25 06:04 robben009

I found that umi.83fcea4e.js dynamically generates some js file names, and then loads these generated js files. nginx cannot proxy these dynamically generated js files because they do not use relative paths

robben009 avatar Apr 16 '25 06:04 robben009

yeah, but Idid not find a way out... kinda complicated if modifying frontend codes...

pamdla avatar Apr 17 '25 03:04 pamdla

I also have the same problem。Have you solved it?

SpencerKD avatar Jun 16 '25 10:06 SpencerKD

no, I am not good at frontend like this kind of frameworks.

pamdla avatar Jun 18 '25 09:06 pamdla

I also have the same problem。Have you solved it?

unstoppbale9527 avatar Jun 30 '25 01:06 unstoppbale9527