Forums

Making previously-created HTTPS link work?

Hello,

I had previously hosted my site at GoDaddy, and I had sent out a link to some other people in the following format: https://<mydomain>.com/<subdir>/ (Actual value = https://joekalb.com/swflholistic )

I migrated my site over to PythonAnywhere. However, now that it is here, is there any way to make that previously sent link work?

It now works correctly if I go to https://www.<mydomain>.com/<subdir>/ (https://www.joekalb.com/swflholistic/), but it does not work if I go to that URL without the www.

I have naked domain forwarding set up (e.g. if you go to https://joekalb.com, it will take you instead to https://www.joekalb.com). But that does not seem to work when there is also a subdirectory involved.

Does anyone know how to successfully redirect from: https://<mydomain>.com/<subdir> to https://www.<mydomain>.com/<subdir>

Thank you!

-Joe

Redirects provided by domain hosts tend to ignore the path in the URL, so don't use them if that's what you want. I would suggest using NakedSSL: https://help.pythonanywhere.com/pages/NakedDomains/#https-redirection

Thanks Glenn.

I tried that. When I go to their site and enter my domain (joekalb.com), it says:

"We can't redirect your domain. Check your URL again and ensure you have a SSL certificate installed. These guides get you started:"

I am currently using the "Auto-renewing Let's Encrypt certificate". But I'm guessing that only applies to the web app at "www.joekalb.com" not to naked "joekalb.com". To add a certificate to my naked domain to make it eligible for nakedssl.com, do I need to install that certificate by working with my domain provider? Is there any way to apply that "Auto-renewing Let's Encrypt certificate" to my naked domain?

Did you actually register to NakedSSL and configure the redirect?

pafk,

I did not register it because when I go to nakedssl.com and enter my domain name on their main page, it says "We can't redirect your domain. Check your URL again and ensure you have a SSL certificate installed..."

Because of that I didn't go any further.

Despite their message telling me it won't work, should I try to register and configure the site anyway?

[Note: I think my use case would be the standard use case for "www." sites hosted on PythonAnywhere. So if it ends up working, it could be a useful thing to have in PythonAnywhere's documentation.]

You need to configure a certificate for your site. You can do that in the Security section on your web app configuration page.

Glenn,

I already have one configured; that's why I'm confused.

In the Security section of my web app configuration page, I have configured it to use the "Auto-renewing Let's Encrypt certificate".

But I'm still getting "We can't redirect your domain. Check your URL again and ensure you have a SSL certificate installed. These guides get you started:" from nakedssl.com main page when I enter my domain name and say "Run Test"

-Joe

Make sure that you reload your web app after making the change.

Okay; I think I had reloaded, but I reloaded again just to be sure.

Immediately after, I went to nakedssl.com, entered my domain name, and clicked "Run Test". It is still giving me the error message:

"We can't redirect your domain. Check your URL again and ensure you have a SSL certificate installed. These guides get you started:"

Ok. Then make sure that the URL you're entering there is actually the URL of your web app.

It is the URL of my web app.

I have tried both "joekalb.com" and "www.joekalb.com" there. ("www.joekalb.com" is my web app)

Either way, it shows: "We can't redirect your domain. Check your URL again and ensure you have a SSL certificate installed. These guides get you started:"

Your web app has a certificate and is working correctly. The only thing I can think of is that it is returning a 404 error. Perhaps they are detecting that and just giving a bad error message.

Are there examples of successful implementations using nakedssl.com for a PythonAnywhere "www." web application?

Because I feel like mine is the standard use case. But I am not seeing how it would work.

I know you aren't NakedSSL support, but PythonAnywhere (generally) recommends it, and it's looking to me like it will not work. I'm just trying to understand if I'm missing some key point.

It seems to me that NakedSSL uses a 301 redirect to take from <mydomain.com> to <www.mydomain.com>, and that it requires <mydomain.com> to have an installed SSL certificate. But for a web app hosted with PythonAnywhere, the certificate would only be installed on <www.mydomain.com>, so it would never find the required certificate at <mydomain.com>.

If that's the case, how do any PythonAnywhere-hosted-"www." sites utilize NakedSSL?

Some tests that I've just done indicate that the problem is (as I suggested above), that you are returning a 404 for your root URL. It also looks like you need to enter the naked domain name into the NakedSSL page.

NakedSSL provides the certificate for the naked domain. If you had a naked domain with a certificate, then you would not need NakedSSL.

Okay, I see what you are saying now about the 404 error: I didn't comprehend what you were talking about when you referenced the 404 the first time (my root www.joekalb.com was returning a 404). That fixed it! I now have it set up with NakedSSL (it will take some time for the DNS to propagate everywhere; I will plan to follow up after a few days to confirm whether the NakedSSL works for the subdirectory once the DNS entries have had time to propagate).

Thank you for your help, Glenn.

For reference, for anyone else: My web app (www.<mydomain.com>) was returning a 404 for the root level (e.g. www.joekalb.com returned a 404), while I had working subdirectories (e.g. www.<mydomain.com>/<mysubdirectory> AKA www.joekalb/swflholistic returned HTTP status 200 and a real Web page).

Because my root page (www.joekalb.com) was returning the 404, NakedSSL.com was giving me an error message that said "We can't redirect your domain. Check your URL again and ensure you have a SSL certificate installed. These guides get you started:". This got me down the path thinking I needed an SSL cert when in reality, I just needed to be returning a valid 200 status from my root http://www.joekalb.com

After returning a boilerplate 200 status and "Under Construction" text at my root domain page (www.joekalb.com), NakedSSL recognized that it can successfully do the "naked-to-www" forward. After doing the basic setup outlined in the NakedSSL setup process, requests to https://<mydomain.com> are now getting successfully forwarded to https://www.<mydomain.com>

Thank you for your help, Glenn and team. Again, I'll plan to confirm in a few days whether the NakedSSL solution works for the subdirectory (e.g. confirm that https://joekalb.com/swflholistic does indeed forward successfully to https://www.joekalb.com/swflholistic)

It worked. Thank you for your assistance.

Glad to hear that!