Skip to content

Instantly share code, notes, and snippets.

@icarrr
Created November 9, 2019 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save icarrr/328478e3b79df39489df780c7ab34a6f to your computer and use it in GitHub Desktop.
Save icarrr/328478e3b79df39489df780c7ab34a6f to your computer and use it in GitHub Desktop.
Fix the Cockpit Blank Page After Login Over Nginx Reverse Proxy
  1. Create new file cockpit.conf on /etc/cockpit, and enter following script in to cockpit.conf.
[WebService]
AllowUnencrypted=true
  1. Update or Create new file conf nginx for access cockpit.
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}

upstream cockpit {
    server localhost:9090;
}

server {
    server_name cockpit.domain.com;

    location / {
        proxy_pass http://cockpit;
        proxy_http_version 1.1;
        proxy_buffering off;
        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $remote_addr;
        # needed for websocket
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
        # change scheme of "Origin" to http
        proxy_set_header Origin http://$host;

        # Pass ETag header from cockpit to clients.
        # See: https://github.com/cockpit-project/cockpit/issues/5239
        gzip off;
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment