# noVNC failed to connect to server

**URL:** <https://discourse.openondemand.org/t/novnc-failed-to-connect-to-server/804>\
**Category:** Get Help\
**Tags:** question\
**Created:** [March 26, 2020, 9:34pm UTC](https://discourse.openondemand.org/t/novnc-failed-to-connect-to-server/804 "2020-03-26T21:34:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ndusek](https://avatars.discourse-cdn.com/v4/letter/n/779978/32.png) [@ndusek](https://discourse.openondemand.org/u/ndusek)\
**Post date:** [March 26, 2020, 9:34pm UTC](https://discourse.openondemand.org/t/novnc-failed-to-connect-to-server/804/1 "2020-03-26T21:34:43Z")

</div>

Hello,

Sorry, this is my 3rd question in 24 hours, but here goes…

I am having trouble getting noVNC to connect to my interactive desktop session. When I look at the node running the job, Websockify and TurboVNC are both running, and I have links to the interactive session in the OOD portal. However, when I open the “Launch Desktop” link, noVNC gives me the error “Failed to connect to the server.”

If I look in the Chrome dev tools, I see the following error:

```auto
app.v1.js:9501 WebSocket connection to 'wss://ondemand.ccast.ndsu.edu/rnode/node0073.thunder.ccast/17053/websockify' failed: Error during WebSocket handshake: Unexpected response code: 302
open @ app.v1.js:9501
_connect @ app.v1.js:6641
_updateConnectionState @ app.v1.js:6879

```

I see some other posts about Websockets [here](https://discourse.openondemand.org/t/websocket-connections-error/707) and [here](https://discourse.openondemand.org/t/failed-to-establish-a-websocket-connection/691/2), but in one of those cases, you mentioned WS might be a “red herring.”

I also saw [this post](https://discourse.openondemand.org/t/novnc-cannot-connect-the-server/461), so I double checked my node regex, and that appears to be showing up correctly in the noVNC link. I also made sure that I can SSH from the OOD node to the node where the desktop is running using this same domain name, and that all works.

Can you suggest some troubleshooting steps so that I can pinpoint the error? I tried looking in the `httpd24` logs and the `ondemand-nginx/$USER` logs and didn’t see anything obvious; but I don’t know exactly what I should be looking for.

Any help would be much appreciated.

Thanks,  
Nick

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [March 26, 2020, 9:57pm UTC](https://discourse.openondemand.org/t/novnc-failed-to-connect-to-server/804/2 "2020-03-26T21:57:50Z")

</div>

Hi! No need to be sorry at all! Especially with the info given.

302 is a redirect from apache, so it’s likely redirecting you to authenticate (it does that for us using open id connect). Do you use CAS by any chance? If you are you may need to change your CASSCope in apache.

It _should_ see you as already authenticated, but it doesn’t. What’s happening is you’re going to create the websock upgrade, but before you can, apache sees you’re not authenticated - for whatever reason, and so doesn’t care and redirects you to do so. The red herring in the other thread was websockify, which is installed on your compute node for VNC (as you need it) but that user was using the shell app which doesn’t rely on it.

---

<div class="post-metadata">

**Author:** ![ndusek](https://avatars.discourse-cdn.com/v4/letter/n/779978/32.png) [@ndusek](https://discourse.openondemand.org/u/ndusek)\
**Post date:** [March 26, 2020, 10:05pm UTC](https://discourse.openondemand.org/t/novnc-failed-to-connect-to-server/804/3 "2020-03-26T22:05:57Z")

</div>

Yes! We are using CAS. From the mod\_auth\_cas documentation, I see the following:

```
Directive:	CASScope
Default:	Off
Description:	Use this directive with an argument as a relative path (e.g. /application/) to specify
		the scope for which a mod_auth_cas cookie is valid. This is beneficial to prevent
		additional round trips to the CAS server. Assume someone authenticates to /application/subdir/
		and then browses to /application/ - without CASScope set, each request would result in
		a round trip to the CAS server and a new cookie being created (one for each directory).
		CASScope would set one cookie, which will be presented on access to both directories.
		Note that if someone accessed /application/ and then /application/subdir/ this would not
		be an issue, but that order of access can not be guaranteed. To disable this feature,
		the special argument 'Off' will return to per-directory cookie paths for this directory
		and subdirectories.

```

So should I set the relative path to `/pun/sys/dashboard` or how would you recommend handling this?

Thanks!  
Nick

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [March 26, 2020, 10:09pm UTC](https://discourse.openondemand.org/t/novnc-failed-to-connect-to-server/804/4 "2020-03-26T22:09:50Z")

</div>

Yea so I think it’s got to be `/`. I don’t know if you can do multiple entires, but if you could there would be at least `/pun`, `/node` and `/rnode`.

---

<div class="post-metadata">

**Author:** ![ndusek](https://avatars.discourse-cdn.com/v4/letter/n/779978/32.png) [@ndusek](https://discourse.openondemand.org/u/ndusek)\
**Post date:** [March 26, 2020, 10:23pm UTC](https://discourse.openondemand.org/t/novnc-failed-to-connect-to-server/804/5 "2020-03-26T22:23:33Z")

</div>

Awesome, setting `CASScope /` fixed the problem.

Thanks so much!

Nick

---

<div class="post-metadata">

**Author:** ![westburg.2](https://avatars.discourse-cdn.com/v4/letter/w/0ea827/32.png) [@westburg.2](https://discourse.openondemand.org/u/westburg.2)\
**Post date:** [May 26, 2022, 3:37pm UTC](https://discourse.openondemand.org/t/novnc-failed-to-connect-to-server/804/6 "2022-05-26T15:37:40Z")

</div>


