Circus web on subfolder, static files absolute path should be relative
Opened this issue · 2 comments
Hi, I'm configuring nginx to route circusweb on a subfolder on my app server, as in:
http://localhost/circus
It's working but all the static files are not being loaded properly, their path is absolute to the host, ie:
href="/static/circus.css?v=6d12a2ee78404c0f52c10de70df855c6"
so it's loading from:
http://localhost/static/circus.css?v=6d12a2ee78404c0f52c10de70df855c6
instead of
http://localhost/circus/static/circus.css?v=6d12a2ee78404c0f52c10de70df855c6
This is my settings on nginx
location /circus/ {
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-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto http;
rewrite /circus/(.*) /$1 break;
proxy_pass http://circusweb_server;
proxy_redirect off;
}
With Chrome inspector, removing the first '/' does the trick.
href="static/circus.css?v=6d12a2ee78404c0f52c10de70df855c6"
@decklord, I am attempting exactly the same Nginx config as you but failing. Did you get anywhere with this? I just had a look at the circushttpd.py
file and it appears to have absolute paths for everything so it seems to be a general issue, not just a static files issue:
class Application(tornado.web.Application):
def __init__(self):
handlers = [
URLSpec(r'/',
IndexHandler, name="index"),
URLSpec(r'/connect/',
ConnectHandler, name="connect"),
URLSpec(r'/disconnect/',
DisconnectHandler, name="disconnect"),
URLSpec(r'/([^/]+)/add_watcher/',
WatcherAddHandler, name="add_watcher"),
URLSpec(r'/([^/]+)/watcher/([^/]+)/',
WatcherHandler, name="watcher"),
URLSpec(r'/([^/]+)/watcher/([^/]+)/switch_status/',
WatcherSwitchStatusHandler, name="switch_status"),
URLSpec(r'/([^/]+)/watcher/([^/]+)/process/kill/([^/]+)/',
KillProcessHandler, name="kill_process"),
URLSpec(r'/([^/]+)/watcher/([^/]+)/process/decr/',
DecrProcHandler, name="decr_proc"),
URLSpec(r'/([^/]+)/watcher/([^/]+)/process/incr/',
IncrProcHandler, name="incr_proc"),
URLSpec(r'/sockets/',
SocketsHandler, name="all_sockets"),
URLSpec(r'/([^/]+)/sockets/',
SocketsHandler, name="sockets"),
]
Finally I made it work using something like
http://circus.localhost/
It didn't work as a "subfolder", circus was assuming that you were on the root. If you find a way, let me know.