-
Notifications
You must be signed in to change notification settings - Fork 53
STU-19: Add SSL Support #1034
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
STU-19: Add SSL Support #1034
Conversation
69f3a67 to
f23bf1e
Compare
|
Yaaaay 😃 I can't wait for this feature to land in production. As far as I can see, this feature prefers to use only one Certificate for all the sites, opposed to LocalWP which creates one for each site. This is already better. Trying to help somehow, I've built this branch and started a new WP instance with HTTPS checked. Some feedback about the |
This might work similarly to Local (although I don't know Local very well). You have to trust what is called the "root" certificate but we do generate a certificate for each site internally, but they will just work when you trust the "root" certificate. |
f23bf1e to
e9a9d53
Compare
matt-west
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @youknowriad!
The dialog with the instructions for trusting a certificate disappears once you click the "Open Certificate File" button. If you didn’t read the instructions fully—which many won’t—you’ll now have to go back and open the dialog again to find out what to do next.
Perhaps we could show these instructions in the site creation modal once you click the link instead?
Let’s add a row to the Settings tab that shows if SSL is enabled. If it is, we should display a Trust link that shows a modal with the instructions for trusting the certificate.
It would be great to have an option to enable SSL for existing sites too. I assume that will require the ability to add custom domains to existing sites first though.
I'll add a row to just show the value but no link at the moment. We need a generic solution to be able to change the url of the WP site. We should create a dedicate issue for that. It applies to both changing the domain and when you trust/untrust a site. |
Do you mean show the instructions inline? I can do that, I'm wondering if it's too much information inline though. |
|
@youknowriad Yes. We can keep the existing link, then show the instructions inline once it’s clicked. |
Screen.Recording.2025-03-11.at.10.27.50.AM.movIs this what you had in mind @matt-west ? I find it a bit weird that you have to click and scroll multiple times. What if instead we keep the dialog but ensure it stays open when you open the certificate. Let me know what you prefer. |
|
@youknowriad Yes, that’s what I thinking. I agree that it feels a bit to have all these extra section appear though. If we can keep the dialog open, that’s a good compromise. |
4d3940e to
4e18cbb
Compare
src/lib/certificate-manager.ts
Outdated
| // macOS - Use sudo to add to system keychain | ||
| await new Promise< void >( ( resolve, reject ) => { | ||
| sudo.exec( | ||
| `security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain "${ CA_CERT_PATH }"`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TLS is way out of my comfort zone, so please bear with me.
Why add the CA as a trusted certificate to the system-wide keychain? Wouldn't it be enough (and more conservative) to add it to the current user's (~/Library/Keychains/login.keychain-db)? If so, I don't think you need sudo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my test it was necessary to install the certificate system wide. But could use more testing.
|
Something that I think is worth trying in the certificate manager:
First I thought of simply setting I believe the procedure goes like this:
|
|
Testing this again, it feels like there are way too many pop-ups if I try to trust the certificate while creating the site. I get lost in all the different dialogs and windows that appear.
I don’t think we should introduce the flow for trusting a certificate as part of the site creation flow. Instead this link should open the browser with a help doc containing the instructions. I can easily keep that alongside Studio while I set up the site, whereas the current dialog prevents me from interacting with the Studio UI.
We then need a link on the site settings tab to open the certificate file. We can include a brief explanation of why the certificate needs to be trusted and a link to the help doc too. Is this possible @youknowriad? |
|
A link on the site settings tab is possible but only after this other PR lands #1064 :) |
|
@youknowriad Why? That PR allows you to change the custom domain, but my suggestion is just to display the "Trust certificate" link + copy for sites that already have SSL enabled. We would hide it for sites that don’t have SSL enabled. We can follow up in another PR to add the ability to enable SSL on an existing site. |
|
@mcsf, your proposal seems quite sound, but two questions popped up for me:
|
|
@matt-west because that PR introduces the code that updates the domain name when you edit site settings which is required when the url moves from http to https. |
So you're saying we should keep the "toggle" on the creation modal, I thought you wanted to remove it from there. Ok, yes, this change we can do here, without waiting for the other PR :) Sorry for the confusion. |
I can't reproduce this.
Yes, this is pending a decision above, either limit the creation of such domains or add a message.
I've noticed this before in other PRs too. Seems like all the comments are addressed. The last blocker is a decision on what to do here https://github.com/Automattic/studio/pull/1034/files/cbbabe32b15459d1e8a7ac0a72e59f58c6eb46ad#diff-e2be6df548f75063abd8db0f241c35626f7af6a1c6a10c429935de5f902dbbc6 |
Was that before making the change to |
You're right, the issue is gone. ✅ |
|
This is a significant change! 🥳 I haven't looked into code much yet, but I reviewed the discussion and tried to approach it as a general Studio user:
The site is started, opens in the browser, and displays a certificate error. I was not sure how to proceed further. As I read the thread above and found some clues, I navigated to Settings and located "HTTP Enabled Trust Certificate. I opened a Questions related to UX:
|
Displaying a dialog seems like a good approach. Trusting the certificate is required, and dialogs can't be missed. This could be a separate PR, because we only want to open that dialog when the root certificate isn't already trusted, and we need to figure out the best way for determining that.
I agree we should do this. I previously suggested adding an explainer text below that checkbox.
Seems like a good idea 👍 This could also be a follow-up PR together with the dialog that opens after adding or editing a site. |
|
Since this PR is getting big and to track the improvements we can make later, I opened this follow-up issue to address the different points that require detection of whether the root certificate is trusted. |
fredrikekelund
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, @youknowriad 👍 I left a couple of final comments, but they are all minor concerns.
Co-authored-by: Fredrik Rombach Ekelund <[email protected]>
|
Thanks all for the help landing this. I'm very excited about this one. The project is not done yet, there's a few related issues, you can follow on Linear. |



Related issues
Summary
This PR adds SSL/HTTPS support to WordPress Studio, allowing users to create sites with custom domains and secure connections. Key features include:
Details
These changes make WordPress Studio sites more realistic for local development by supporting custom domains with proper HTTPS, closely mimicking production environments.
Testing instructions
I didn't test Windows yet.
The PR is largely unpolished at the moment but I believe it's a decent start, so we can start looking at polishing the UI and the implementation.