简体   繁体   中英

HTTPS on Vibe.d

On my linode box I installed the Let's Encrypt SSL certs and created a bare-bones Vibe.d app to test my SSL connection. I always timeout. Here is the code:

import vibe.vibe;

void main()
{
        auto settings = new HTTPServerSettings;
        settings.port = 8080;
        settings.bindAddresses = ["::1", "127.0.0.1","50.116.15.145"];
        settings.tlsContext = createTLSContext(TLSContextKind.server);
        settings.tlsContext.useCertificateChainFile("/etc/letsencrypt/live/findyourtutor.info/cert.pem");
        settings.tlsContext.usePrivateKeyFile("/etc/letsencrypt/live/findyourtutor.info/privkey.pem");
        listenHTTP(settings, &hello);

        logInfo("Please open 'http://www.findyourtutor.info' in your browser.");
        runApplication();
}

void hello(HTTPServerRequest req, HTTPServerResponse res)
{
        res.writeBody("Hello, World!");
}

If I simply visit

www.findyourtutor.info or
findyourtutor.info

I can view them fine.

But if I visit https://findyourtutor.info , I time out.

I also time out with

https://findyourtutor.info:8080
https://www.findyourtutor.info
https://www.findyourtutor.info:8080

When logged in at linode, I can do

lynx https://localhost:8080

and lynx warns me about the certificates but I can see the site after pressing 'y' twice.

I can also do

lynx http://localhost

but not

lynx http://localhost:8080

At this point I don't know if my code is at fault or my setup is at fault.

My UFW firewall allows HTTPS from anywhere.

I would use nginx as a proxy for your vibe-d app, this is better then try to use vibed with ssl.

But your setup seems really wierd. You are listening on 8080, so it should not be possible to access your site with www.findyourtutor.info or findyourtutor.info without specify port somehow, so I guess there is some other web server in play. You should try to listen on 443 if you want to use https . Or do you have allready some proxy?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM