Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Circus web on subfolder, static files absolute path should be relative #46

Open
decklord opened this issue Aug 28, 2014 · 2 comments
Open

Comments

@decklord
Copy link

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 decklord changed the title Circus web on subfolder, absolute static files path Circus web on subfolder, static files absolute path should be relative Aug 28, 2014
@nokome
Copy link

nokome commented Feb 14, 2015

@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"),
        ]

@decklord
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants