Forum

Hostname for WebSocket

Jim Sung
9 February 2019, 09:36
Dear Sir:

I'm trying to get WebSocket to work with the following VirtualHost:
VirtualHost {
HostName = *
WebsiteRoot = /var/www/hiawatha
WebSocket = ws://127.0.0.1:7681 /websocket
# WebSocket = wss://127.0.0.1:7681 /websocket
}

but I'm getting a 404.

After instrumenting the code and looking at hostname_match() in libstr.c, I don't think "*" will "match anything", which is what I thought it will do initially, so what should I set "Hostname" to?

I've read https://www.hiawatha-webserver.org/forum/topic/2630 and https://www.hiawatha-webserver.org/forum/topic/2839.

Thanks.

Jim
Jim Sung
11 February 2019, 03:00
Hi Hugo:

In https://www.hiawatha-webserver.org/forum/topic/2630, you wrote
Hiawatha only provides the protocol switch and the connectivity.
so if I understood you correctly, if HTTP/HTTPS host is X, then WS/WSS host needs to be Y (X and Y can have the same IP address), is that correct?

In the back-end, I have "libwebsockets", so it will handle the protocol.

Thanks in advance for any clarification.

Jim
This topic has been closed.