Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8453145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:41:34+00:00 2026-06-10T11:41:34+00:00

Currently using a really simple Twisted NameVirtualHost coupled with some JSON config files to

  • 0

Currently using a really simple Twisted NameVirtualHost coupled with some JSON config files to serve really basic content in one Site object. The resources being served by Twisted are all WSGI objects built in flask.

I was wondering on how to go about wrapping the connections to these domains with an SSLContext, since reactor.listenSSL takes one and only one context, it isn’t readily apparent how to give each domain/subdomain it’s own crt/key pair. Is there any way to set up named virtual hosting with ssl for each domain that doesn’t require proxying? I can’t find any Twisted examples that use NameVirtualHost with SSL, and they only thing I could get to work is hook on the reactor listening on port 443 with only one domain’s context?

I was wondering if anyone has attempted this?

My simple server without any SSL processing:

https://github.com/DeaconDesperado/twsrv/blob/master/service.py

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T11:41:36+00:00Added an answer on June 10, 2026 at 11:41 am

    TLS (the name for the modern protocol which replaces SSL) only very recently supports the feature you’re looking for. The feature is called Server Name Indication (or SNI). It is supported by modern browsers on modern platforms, but not some older but still widely used platforms (see the wikipedia page for a list of browsers with support).

    Twisted has no specific, built-in support for this. However, it doesn’t need any. pyOpenSSL, upon which Twisted’s SSL support is based, does support SNI.

    The set_tlsext_servername_callback pyOpenSSL API gives you the basic mechanism to build the behavior you want. This lets you define a callback which is given access to the server name requested by the client. At this point, you can specify the key/certificate pair you want to use for the connection. You can find an example demonstrating the use of this API in pyOpenSSL’s examples directory.

    Here’s an excerpt from that example to give you the gist:

    def pick_certificate(connection):
        try:
            key, cert = certificates[connection.get_servername()]
        except KeyError:
            pass
        else:
            new_context = Context(TLSv1_METHOD)
            new_context.use_privatekey(key)
            new_context.use_certificate(cert)
            connection.set_context(new_context)
    
    server_context = Context(TLSv1_METHOD)
    server_context.set_tlsext_servername_callback(pick_certificate)
    

    You can incorporate this approach into a customized context factory and then supply that context factory to the listenSSL call.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently using android NDK to write some native code in C. I have
Let's take a really simple example on using jQuery to ajaxify our page... $.load(getOrders.aspx,
I'm trying to write a really simple GUI app for inserting some records into
I am currently trying to develop a simple plugin for visual studio 2008 using
I'm currently using fopen to write/read binary files. With small files all is fines.
Currently i'm using pretty much Unix + Mysql + Perl + Apache with some
Currently using Gettext on a project and the .po files are nicely kept under
This should be really simple. I am using SSMS 2008, trying to get a
One of the features that really impressed me with Stack Overflow was the simple
I'm currently working on this really simple text based game and to play again,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.