You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When accessing a Gradio application through Nginx reverse proxy, the main page loads but static assets (JS/CSS) fail to load with 404 errors when the page attempts to fetch them automatically.
Have you searched existing issues? 🔎
I have searched and found no existing issues
Reproduction
gradio code
importgradioasgrimporttimedeftest(x):
time.sleep(4)
returnxgr.Interface(test, "textbox", "textbox").queue().launch(
root_path="/webui", # add i also try to use nginx+http://0.0.0.0:7861/ with no root_path="/webui"server_name="0.0.0.0",
server_port=7861
)
Current Behavior
localhost:9999/webui loads successfully and returns the Gradio web interface
When the page tries to fetch its assets, the following requests return 404:
localhost:9999/assets/index-Dj1xzGVg.js
localhost:9999/assets/index-Bmd1Nf3q.css
I manually tried accessing with the /webui prefix, but still got 404:
localhost:9999/webui/assets/index-Dj1xzGVg.js
localhost:9999/webui/assets/index-Bmd1Nf3q.css
However, accessing directly through port 7861 works:
localhost:7861/webui/assets/index-Dj1xzGVg.js
localhost:7861/webui/assets/index-Bmd1Nf3q.css
Expected Behavior
Static assets should load correctly when accessing the application through the Nginx reverse proxy at localhost:9999/webui.
Question
Is there something wrong with my configuration? How can I properly serve Gradio's static assets through the Nginx reverse proxy?
Additional Notes
The main application interface loads correctly
Static assets (JS/CSS) fail to load when the page tries to fetch them automatically
Direct access to the Gradio server works as expected
Nginx Configuration
server {
listen 9999;
server_name _;
root /root;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ [^/]\.php(/|$) {
try_files $uri =404;
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
fastcgi_index index.php;
set $path_info $fastcgi_path_info;
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
set $real_script_name $1;
set $path_info $2;
}
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
location /webui {
proxy_pass http://0.0.0.0:7861/webui/; # and i also try to use http://0.0.0.0:7861/ with no root_path="/webui"
proxy_buffering off;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Screenshot
Gradio is running normally on port 7861, and 7861/webui can also be accessed.
The following is the situation on localhost:9999:
The webpage opens up as a blank page.
However, the returned HTML contains Gradio content.
Logs
None
System Info
Gradio Environment Information:
------------------------------
Operating System: Linux
gradio version: 5.6.0
gradio_client version: 1.4.3
------------------------------------------------
gradio dependencies in your environment:
aiofiles: 23.2.1
anyio: 4.3.0
audioop-lts is not installed.
fastapi: 0.115.5
ffmpy: 0.4.0
gradio-client==1.4.3 is not installed.
httpx: 0.27.0
huggingface-hub: 0.26.2
jinja2: 3.1.3
markupsafe: 2.1.5
numpy: 2.1.3
orjson: 3.10.11
packaging: 24.0
pandas: 2.2.3
pillow: 11.0.0
pydantic: 2.9.2
pydub: 0.25.1
python-multipart==0.0.12 is not installed.
pyyaml: 6.0.1
ruff: 0.7.4
safehttpx: 0.1.1
semantic-version: 2.10.0
starlette: 0.41.2
tomlkit==0.12.0 is not installed.
typer: 0.13.0
typing-extensions: 4.11.0
urllib3: 2.2.1
uvicorn: 0.32.0
authlib; extra == 'oauth' is not installed.
itsdangerous; extra == 'oauth' is not installed.
gradio_client dependencies in your environment:
fsspec: 2024.10.0
httpx: 0.27.0
huggingface-hub: 0.26.2
packaging: 24.0
typing-extensions: 4.11.0
websockets: 12.0
Severity
Blocking usage of gradio
The text was updated successfully, but these errors were encountered:
Describe the bug
When accessing a Gradio application through Nginx reverse proxy, the main page loads but static assets (JS/CSS) fail to load with 404 errors when the page attempts to fetch them automatically.
Have you searched existing issues? 🔎
Reproduction
gradio code
Current Behavior
localhost:9999/webui
loads successfully and returns the Gradio web interfacelocalhost:9999/assets/index-Dj1xzGVg.js
localhost:9999/assets/index-Bmd1Nf3q.css
I manually tried accessing with the /webui prefix, but still got 404:
localhost:9999/webui/assets/index-Dj1xzGVg.js
localhost:9999/webui/assets/index-Bmd1Nf3q.css
However, accessing directly through port 7861 works:
localhost:7861/webui/assets/index-Dj1xzGVg.js
localhost:7861/webui/assets/index-Bmd1Nf3q.css
Expected Behavior
Static assets should load correctly when accessing the application through the Nginx reverse proxy at
localhost:9999/webui
.Question
Is there something wrong with my configuration? How can I properly serve Gradio's static assets through the Nginx reverse proxy?
Additional Notes
Nginx Configuration
Screenshot
Gradio is running normally on port 7861, and 7861/webui can also be accessed.
The following is the situation on localhost:9999:
The webpage opens up as a blank page.
However, the returned HTML contains Gradio content.
Logs
System Info
Severity
Blocking usage of gradio
The text was updated successfully, but these errors were encountered: