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

Blank pages with Cockpit behind Nginx #5934

Closed
Nontenda opened this issue Feb 23, 2017 · 16 comments
Closed

Blank pages with Cockpit behind Nginx #5934

Nontenda opened this issue Feb 23, 2017 · 16 comments

Comments

@Nontenda
Copy link

Hi,

I've just installed on a fresh CentOS 7 the last version of Nginx and Cockpit (epel repository).

I followed https://github.com/cockpit-project/cockpit/wiki/Proxying-Cockpit-over-NGINX and have the same config file.

After login I got a blank page, if I do a "F5" the index page shows up and a "Oups" appears on the top right of the screen and disappear after a few seconds.

My network activity shows that the last answer from the webserver is a "101 Switching protocol" on /cockpit/socket.

If I click on Logs or System or Services --> The menu on the left is visible, but the content is blank.
You can see it here : https://i.imgur.com/UeETC9p.png

Can you help me on that ?

@petervo
Copy link
Contributor

petervo commented Feb 23, 2017

Is there anything in your browser javascript console? There should be some sort of error there.

Is there anything in the journal on the machine?

@petervo
Copy link
Contributor

petervo commented May 1, 2017

Closing because we haven't heard back. Please reopen if you are still having issues.

@petervo petervo closed this as completed May 1, 2017
@ghost
Copy link

ghost commented Oct 16, 2017

@petervo I seem to have this issue but using apache2
I am running cockpit on port 9090 as default but I changed the certificate to my domain cert.
The cert loads and works because locally it sees the cert and on the login it works but once I am logged in it shows a blank page with some JS errors in the console.

@ghost
Copy link

ghost commented Oct 16, 2017

VM303:164 WebSocket connection to 'wss://console.stardebris.net/cockpit/socket' failed: Error during WebSocket handshake: Unexpected response code: 400

This is one of them, I think this is the issue.
I do have wstunnel mod installed in apache2

I thought of adding ws to the reverseproxy with empty results =//

@ghost
Copy link

ghost commented Oct 16, 2017

I added the following line to my virtualhost as I said in my previous comment, this gave no results but it might be useful to mention it.

ProxyPass "/cockpit/console" "wss://127.0.0.1:9090/"

@ghost
Copy link

ghost commented Oct 16, 2017

Okay, nevermind

For apache2 users add the following to your virtual host

	RequestHeader edit Origin ^https: http: early

        ProxyPass /cockpit/socket ws://127.0.0.1:9090/cockpit/socket
        ProxyPassReverse /cockpit/socket ws://127.0.0.1:9090/socket
        ProxyPass / http://127.0.0.1:9090/
        ProxyPassReverse / http://127.0.0.1:9090/
        
        RequestHeader set X-Forwarded-Proto "https"
        RequestHeader set X-Forwarded-Port "443"

@jmtsantos
Copy link

For nginx https://gist.github.com/norwat/c3287e023a1be4958f5847331fcbe1b7

@moso
Copy link

moso commented Nov 30, 2017

@norwat: I have the same nginx config more or less (I have even tried to replicate it 100%), and I still get WebSocket connection to 'wss://<url>/cockpit/socket' failed: Error during WebSocket handshake: Unexpected response code: 403.

Nginx errors out if I proxy_pass anything to wss:// and tells me it's an invalid URL prefix.

I'm running Ubuntu 16.04.3 LTS with Nginx 1.10.3.

@jmtsantos
Copy link

@moso: I dont remember having that specific issue. But it might have something to do with cockpit config, try this see if it helps:

root@xxxxx ~ # cat /etc/cockpit/cockpit.conf
[WebService]
AllowUnencrypted=true

Im running CentOS 7 with Nginx 1.13.7

@petervo
Copy link
Contributor

petervo commented Nov 30, 2017

@moso, generally you terminate ssl with nginx and proxy to cockpit unencrypted. If you do that the you use ws:// instead in your nginx config along with @norwat's settings. Otherwise you probably need to either get nginx to trust or not validate cockpit's ssl certificate.

@moso
Copy link

moso commented Nov 30, 2017

@petervo I got it working by removing Origin from cockpit.conf. Thanks though!

@NoobKeksTV
Copy link

I have The Problem on apache2 even after i added

RequestHeader edit Origin ^https: http: early

       ProxyPass /cockpit/socket ws://127.0.0.1:9090/cockpit/socket
       ProxyPassReverse /cockpit/socket ws://127.0.0.1:9090/socket
       ProxyPass / http://127.0.0.1:9090/
       ProxyPassReverse / http://127.0.0.1:9090/
       
       RequestHeader set X-Forwarded-Proto "https"
       RequestHeader set X-Forwarded-Port "443"

to my virtual hosts .conf file.

@WitnessMee
Copy link

From man cockpit.conf

Origins
By default cockpit will not accept crossdomain websocket connections. Use this setting to allow access from alternate domains. Origins should include scheme, host and port, if necessary.

This means if you are trying to access cockpit from a public domain name (e.g. https://cockpit.yourdomain.com) it will not work.
Create /etc/cockpit/cockpit.conf (by default it does not exist) and add this

[WebService]
Origins = https://cockpit.yourdomain.com

@ebedtang
Copy link

ebedtang commented Jan 5, 2021

I get protocol-error notification in my browser after i click login button. I already set it up according to what said in cockpit page on github. I have also tried removing the origin config.

@Devnol
Copy link

Devnol commented Feb 19, 2021

I am using nginx as well, norwat's gist leads to a 404. If possible please restore it as it may be helpful to me and other people.

@soulhax
Copy link

soulhax commented Mar 16, 2021

Same issue.
When I initially did the setup it worked like a charm.
After logging off the server it now shows me a blank white page with the socket error in console.

Tried already everything and nothing helps. Using apache2

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

9 participants