Project

General

Profile

Using both SSL and non-SSL communication with Wt app(s)

Added by Peter K over 12 years ago

Hi,

I would like to be able to use both encrypted and unencrypted communication in my Wt application... The encrypted pathway would be for sign-in, payment page and so on, and the normal pathway for everything else.

I understand that this cannot be done with just one Wthttpd server. How would you go about accomplishing this? Run two instances of a server, in two different applications, and communicate between them with boost::asio? Are there any other ways of doing it?

Thanks!

Peter


Replies (1)

RE: Using both SSL and non-SSL communication with Wt app(s) - Added by Wim Dumon over 12 years ago

Hello Peter,

Sure this is possible. You can start wthttpd so that it listens both to HTTPS and HTTP traffic. Just specify http-port, http-address, https-port, https-address (and all other options required for https, such as certificates).

To switch between http and https in your application, use WApplication::redirect(), like this:

// switch to https
wApp->redirect("https://myserver.com/" + wApp->url());
// switch back to http
wApp->redirect("http://myserver.com/" + wApp->url());

Wim.

    (1-1/1)