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

fix: Gitpod and Codespaces can use HTTPS #5943

Merged

Conversation

stasadev
Copy link
Member

@stasadev stasadev commented Mar 7, 2024

The Issue

The refactored code had an incorrect condition for Gitpod and Codespaces.

The primary URL should point to the Gitpod or Codespaces URL.

$ ddev describe -j
...
"httpURLs": [
  "http://127.0.0.1:8080"
],
"httpsURLs": null,

How This PR Solves The Issue

I tried to add Gitpod and Codespaces generated URLs to httpURLs, it worked, but the result was confusing:

$ ddev describe -j
"httpURLs": [
  "https://d10-8080.app.github.dev",
  "http://127.0.0.1:8080"
],
"httpsURLs": null,

So I reverted the check for HTTP, and now it works as it should:

$ ddev describe -j
...
"httpURLs": [
  "http://127.0.0.1:8080"
],
"httpsURLs": [
  "https://d10-8080.app.github.dev"
],

Also ddev describe did not show All URLs with disabled router, so I moved the condition.

Manual Testing Instructions

Without using Codespaces:

export DDEV_PRETEND_CODESPACES=true CODESPACE_NAME=d10 GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN=app.github.dev
ddev start
ddev describe

A simple ddev describe comparison with stable DDEV will show the difference.

Before:

┌──────────────────────────────────────────────────────────────────────┐
│ Project: d10 ~/code/ddev/d10 http://127.0.0.1:8080                   │
│ Docker platform: linux-docker                                        │
│ Router: disabled                                                     │
├─────────┬──────┬────────────────────────────────┬────────────────────┤
│ SERVICE │ STAT │ URL/PORT                       │ INFO               │
├─────────┼──────┼────────────────────────────────┼────────────────────┤
│ web     │ OK   │ http://127.0.0.1:8080          │ php PHP8.3         │
│         │      │ InDocker: web:8025,443,80      │ nginx-fpm          │
│         │      │ Host: 127.0.0.1:8443,8080,8027 │ docroot:''         │
│         │      │                                │ Perf mode: none    │
│         │      │                                │ NodeJS:20          │
├─────────┼──────┼────────────────────────────────┼────────────────────┤
│ db      │ OK   │ InDocker: db:3306              │ mysql:8.0          │
│         │      │ Host: 127.0.0.1:3306           │ User/Pass: 'db/db' │
│         │      │                                │ or 'root/root'     │
├─────────┼──────┼────────────────────────────────┼────────────────────┤
│ Network │      │ bind-all-interfaces ENABLED    │                    │
└─────────┴──────┴────────────────────────────────┴────────────────────┘

After:

┌──────────────────────────────────────────────────────────────────────────┐
│ Project: d10 ~/code/ddev/d10 https://d10-8080.app.github.dev             │
│ Docker platform: linux-docker                                            │
│ Router: disabled                                                         │
├──────────┬──────┬───────────────────────────────────┬────────────────────┤
│ SERVICE  │ STAT │ URL/PORT                          │ INFO               │
├──────────┼──────┼───────────────────────────────────┼────────────────────┤
│ web      │ OK   │ https://d10-8080.app.github.dev   │ php PHP8.3         │
│          │      │ InDocker: web:443,80,8025         │ nginx-fpm          │
│          │      │ Host: 127.0.0.1:8443,8080,8027    │ docroot:''         │
│          │      │                                   │ Perf mode: none    │
│          │      │                                   │ NodeJS:20          │
├──────────┼──────┼───────────────────────────────────┼────────────────────┤
│ db       │ OK   │ InDocker: db:3306                 │ mysql:8.0          │
│          │      │ Host: 127.0.0.1:3306              │ User/Pass: 'db/db' │
│          │      │                                   │ or 'root/root'     │
├──────────┼──────┼───────────────────────────────────┼────────────────────┤
│ Network  │      │ bind-all-interfaces ENABLED       │                    │
└──────────┴──────┴───────────────────────────────────┴────────────────────┘

Automated Testing Overview

Related Issue Link(s)

Release/Deployment Notes

Copy link

github-actions bot commented Mar 7, 2024

@stasadev
Copy link
Member Author

stasadev commented Mar 7, 2024

False alarm, this logic should remain unchanged:

@stasadev stasadev closed this Mar 7, 2024
@stasadev stasadev deleted the 20240307_stasadev_https_gitpod_codespaces branch March 7, 2024 15:11
@stasadev stasadev restored the 20240307_stasadev_https_gitpod_codespaces branch May 13, 2024 16:50
@stasadev
Copy link
Member Author

Reopening with updated PR description.

@stasadev stasadev reopened this May 13, 2024
@stasadev stasadev force-pushed the 20240307_stasadev_https_gitpod_codespaces branch from 0583863 to 42ebfab Compare May 13, 2024 17:08
@stasadev stasadev changed the title fix: Gitpod and Codespaces can use HTTPS fix: Gitpod and Codespaces can use HTTPS, fixes #6102 May 13, 2024
@stasadev stasadev force-pushed the 20240307_stasadev_https_gitpod_codespaces branch from 42ebfab to 315b63e Compare May 13, 2024 17:48
@stasadev stasadev added this to the v1.23.1 milestone May 14, 2024
Copy link
Member

@rfay rfay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Copy link
Member

@rfay rfay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is correct, but it does not solve #6102. I tried this on codespaces, and once you log in to a Drupal site it redirects to an inappropriate URL.

@rfay ➜ /workspaces/d10simple (main) $ ddev --version
ddev version v1.23.0-27-g315b63ea8
@rfay ➜ /workspaces/d10simple (main) $ ddev describe
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Project: d10simple /workspaces/d10simple https://probable-computing-machine-x5797jj6rfvqx5-8080.app.github. │
│ dev                                                                                                         │
│ Docker platform: linux-docker                                                                               │
│ Router: disabled                                                                                            │
├─────────┬──────┬───────────────────────────────────────────────────────────────────────┬────────────────────┤
│ SERVICE │ STAT │ URL/PORT                                                              │ INFO               │
├─────────┼──────┼───────────────────────────────────────────────────────────────────────┼────────────────────┤
│ web     │ OK   │ https://probable-computing-machine-x5797jj6rfvqx5-8080.app.github.dev │ drupal10 PHP8.2    │
│         │      │ InDocker: web:443,80,8025                                             │ nginx-fpm          │
│         │      │ Host: 127.0.0.1:8443,8080,8027                                        │ docroot:'web'      │
│         │      │                                                                       │ Perf mode: none    │
│         │      │                                                                       │ NodeJS:20          │
├─────────┼──────┼───────────────────────────────────────────────────────────────────────┼────────────────────┤
│ db      │ OK   │ InDocker: db:3306                                                     │ mariadb:10.11      │
│         │      │ Host: 127.0.0.1:3306                                                  │ User/Pass: 'db/db' │
│         │      │                                                                       │ or 'root/root'     │
├─────────┼──────┼───────────────────────────────────────────────────────────────────────┼────────────────────┤
│ Network │      │ bind-all-interfaces ENABLED                                           │                    │
└─────────┴──────┴───────────────────────────────────────────────────────────────────────┴────────────────────┘
 
@rfay ➜ /workspaces/d10simple (main) $ ddev launch
@rfay ➜ /workspaces/d10simple (main) $ # ddev launch takes me to https://probable-computing-machine-x5797jj6rfvqx5-8080.app.github.dev/
@rfay ➜ /workspaces/d10simple (main) $ # When you log in it at /user it redirect to invalid https://probable-computing-machine-x5797jj6rfvqx5-8080.app.github.dev:8080/en/user/1?check_logged_in=1

There may certainly be something here that is Drupal's fault, but I haven't seen it in other situations.

It's OK to pull this if you think it should go in now, but doesn't fix the original problem.

@rfay
Copy link
Member

rfay commented May 16, 2024

@stasadev it's your call whether to pull this and it's an incremental improvement or whether we should defer it and figure out the rest of what's going on with codespaces. We can either hold it back and move forward with release or we can pull it (does no harm as far as I can see, although I didn't test on gitpod). Either way, we're good to do a release.

@stasadev
Copy link
Member Author

Okay, thanks for checking.
Then it only solves the problem with the primary URL found by @mandrasch.
I will pull it.

@stasadev stasadev changed the title fix: Gitpod and Codespaces can use HTTPS, fixes #6102 fix: Gitpod and Codespaces can use HTTPS May 16, 2024
@stasadev stasadev merged commit 7c6af31 into ddev:master May 16, 2024
21 of 22 checks passed
@stasadev stasadev deleted the 20240307_stasadev_https_gitpod_codespaces branch May 16, 2024 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants