Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wildcard subdomains #502

Open
joepio opened this issue Sep 23, 2022 · 0 comments · May be fixed by #505
Open

Wildcard subdomains #502

joepio opened this issue Sep 23, 2022 · 0 comments · May be fixed by #505

Comments

@joepio
Copy link
Member

joepio commented Sep 23, 2022

I'm trying to find out if we can host multiple subdomains from actix-web with TLS enabled. See #288.

#[tracing::instrument(skip(appstate, req))]
pub async fn handle_get_resource(
    path: Option<web::Path<String>>,
    appstate: web::Data<AppState>,
    req: actix_web::HttpRequest,
    conn: actix_web::dev::ConnectionInfo,
) -> AtomicServerResult<HttpResponse> {
    let mut timer = Timer::new();

    let domain = &appstate.config.opts.domain;
    let host = conn.host();
    let find = host.find(domain);
    let subdomain = if let Some(index) = find {
        if index == 0 {
            None
        } else {
            Some(host[0..index - 1].to_string())
        }
    } else {
        panic!("Wrong domain! A requested URL did not contain the host for this domain. This should not be able to happen.");
    };
    println!("subdomain: {:?}", subdomain);

    let headers = req.headers();

Update: managed to read the subdomains from requests. Assuming TLS works with wildcards, what will be next? I feel like I need to think about this more, before doing any implementation.

EDIT:

We have a problem. LetsEncrypt doesn't issue wildcard certificates using HTTP-01 checks! We need a DNS check!

So for our specific case, this isn't that bad. But what about regular users who don't need subdomains? We might have to support both!

Unfortunately, doing http-01 checks with the new library I'm trying to use is a bit difficult. Maybe this changes. If it doesn't change, I suppos we should stop supporting the Http01 setup. :'(

EDIT 2:

I've added both http-01 and dns-01 setup options. Cool, right?

This was referenced Sep 26, 2022
joepio added a commit that referenced this issue Sep 30, 2022
joepio added a commit that referenced this issue Oct 11, 2022
joepio added a commit that referenced this issue Oct 11, 2022
joepio added a commit that referenced this issue Oct 11, 2022
joepio added a commit that referenced this issue Oct 12, 2022
joepio added a commit that referenced this issue Oct 12, 2022
joepio added a commit that referenced this issue Oct 12, 2022
joepio added a commit that referenced this issue Oct 12, 2022
WIP Path URL

#502 URLs
joepio added a commit that referenced this issue Oct 13, 2022
joepio added a commit that referenced this issue Oct 13, 2022
WIP Path URL

#502 URLs
joepio added a commit that referenced this issue Oct 16, 2022
joepio added a commit that referenced this issue Nov 2, 2022
joepio added a commit that referenced this issue Nov 2, 2022
WIP Path URL

#502 URLs
joepio added a commit that referenced this issue Nov 2, 2022
joepio added a commit that referenced this issue Nov 9, 2022
joepio added a commit that referenced this issue Nov 9, 2022
WIP Path URL

#502 URLs
joepio added a commit that referenced this issue Nov 9, 2022
joepio added a commit that referenced this issue Dec 16, 2022
joepio added a commit that referenced this issue Dec 16, 2022
WIP Path URL

#502 URLs
joepio added a commit that referenced this issue Dec 16, 2022
joepio added a commit that referenced this issue Dec 27, 2022
joepio added a commit that referenced this issue Jan 23, 2023
joepio added a commit that referenced this issue Jan 23, 2023
WIP Path URL

#502 URLs
joepio added a commit that referenced this issue Jan 23, 2023
joepio added a commit that referenced this issue Jan 23, 2023
joepio added a commit that referenced this issue Jan 24, 2023
joepio added a commit that referenced this issue Jan 24, 2023
WIP Path URL

#502 URLs
joepio added a commit that referenced this issue Jan 24, 2023
joepio added a commit that referenced this issue Feb 5, 2023
WIP Path URL

#502 URLs
joepio added a commit that referenced this issue Feb 5, 2023
joepio added a commit that referenced this issue Feb 5, 2023
joepio added a commit that referenced this issue Feb 25, 2023
WIP Path URL

#502 URLs
joepio added a commit that referenced this issue Feb 25, 2023
joepio added a commit that referenced this issue Feb 25, 2023
joepio added a commit that referenced this issue Feb 28, 2023
WIP Path URL

#502 URLs
joepio added a commit that referenced this issue Feb 28, 2023
joepio added a commit that referenced this issue Feb 28, 2023
joepio added a commit that referenced this issue Mar 11, 2023
WIP Path URL

#502 URLs
joepio added a commit that referenced this issue Mar 11, 2023
joepio added a commit that referenced this issue Mar 11, 2023
joepio added a commit that referenced this issue Mar 30, 2023
WIP Path URL

#502 URLs
joepio added a commit that referenced this issue Mar 30, 2023
joepio added a commit that referenced this issue Mar 30, 2023
joepio added a commit that referenced this issue Jul 31, 2023
WIP Path URL

#502 URLs
joepio added a commit that referenced this issue Jul 31, 2023
joepio added a commit that referenced this issue Jul 31, 2023
joepio added a commit that referenced this issue Jul 31, 2023
joepio added a commit that referenced this issue Jul 23, 2024
WIP Path URL

#502 URLs
joepio added a commit that referenced this issue Jul 23, 2024
joepio added a commit that referenced this issue Jul 23, 2024
joepio added a commit that referenced this issue Jul 23, 2024
joepio added a commit that referenced this issue Jul 23, 2024
WIP Path URL

#502 URLs
joepio added a commit that referenced this issue Jul 23, 2024
joepio added a commit that referenced this issue Jul 23, 2024
joepio added a commit that referenced this issue Jul 23, 2024
joepio added a commit that referenced this issue Oct 7, 2024
joepio added a commit that referenced this issue Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant