[Libwebsockets] How to redirect http to https? If it needs vhost on 80, how to create a vhost?

satya gowtham kudupudi satyagowtham.k at gmail.com
Tue Dec 6 19:18:23 CET 2016


What I have done is I have copied the info of actual host running on 443 and set the port to 80 and created a new context with the copied info.

info.vhost_name="www.ferryfair.com <http://www.ferryfair.com/>";
lws_context_creation_info http_info = info;
http_info.options &= ~LWS_SERVER_OPTION_REDIRECT_HTTP_TO_HTTPS;
infohttp.port=80;
lws_context* httpcontext = lws_create_context(&wss->infohttp);
struct lws_vhost* pVHost=lws_create_vhost(wss->httpcontext,  wss->infohttp);

Should I have to service the httpcontext as well?
n = lws_service(httpcontext, 10);


> On 06-Dec-2016, at 10:53 PM, satya gowtham kudupudi <satyagowtham.k at gmail.com> wrote:
> 
> I am listening on 443 with TLS enabled. http request to 443 are being updated to https. http requests to 80 will fail. How to run a vhost on 80 and redirect to 443?
> 
> --
> Gowtham

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20161206/09ee3d2d/attachment-0001.html>


More information about the Libwebsockets mailing list