Skip to content

Document proper reverse proxy setup #34

Description

@schnuffle

I've been reading the issues about using nginx as reverse proxy, so there're people where it seems to work.
The problem is that there isn't enough info to set it up properly.
My setup:

nginx:

location / {
    # First attempt to serve request as file, then
    # as directory, then fall back to displaying a 404.
    #try_files $uri $uri/ =404;
    proxy_pass http://127.0.0.1:3000;
}

location /ws {
    proxy_pass http://127.0.0.1:3000;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-for $proxy_add_x_forwarded_for;
    proxy_set_header Host $host:$server_port;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_connect_timeout 600;
    proxy_read_timeout 600;
    client_max_body_size 1024M; # Set higher depending on your needs
}

Virtlyst config:

[wsgi]
    master = true
    threads = auto
    http-socket = 127.0.0.1:3000
    application = /usr/local/lib/libVirtlyst.so
    chdir2 = /usr/local/var/virtlyst
    static-map = /static=/usr/local/var/virtlyst/root/static

[Cutelyst]
    production = true
    DatabasePath = /usr/local/var/virtlyst/virtlyst.sqlite
    TemplatePath = /usr/local/var/virtlyst/root/src

[Rules]
    cutelyst.* = true
    virtlyst.* = true

Everything works fine but the console. When I open a console, I can find following error in the browser debug console:

ERROR: WebSocket error: Can't connect to websocket on URL: wss://127.0.0.1:3000/ws/2/2d8a0b35-e63d-4c46-b8ad-420d3fabf271

Now I ask myself, how is the WSS URL build up?

From testing it seem it uses http-socket = 127.0.0.1:3000.

I'll write the docs howto set it up properly, but I need a working setup first :-).

Regards

Schnuffle

P.S.: The connection to libvirt is with a local socket

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions