-
I installed latest ddev in WSL2/Ubuntu. When I start a default PHP 8.4 project, the global server variable $_SERVER['SERVER_PORT'] has always value 80. What is the easiest way to change this behavior, when I open https://mypage.ddev.site:443 to get value 443 instead? On my local machine it is absolutely fine not having a valid SSL certificate, is this the only reason for this wrong value?Q |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @JayQ1982 - This is the same situation as on a normal server environment, where you have a reverse proxy in front of your web server. In DDEV, the ddev-router accepts traffic on 443 and proxies it to the ddev-webserver on port 80. If you want to know the actual URLs in any environment, you'll want to use the X_ variables, in your case HTTP_X_FORWARDED_PORT and HTTP_X_FORWARDED_PROTO:
More architecture detail in https://ddev.readthedocs.io/en/stable/users/usage/architecture This article might help too, https://serverfault.com/questions/256191/getting-correct-server-port-to-php-fpm-through-nginx-and-varnish Since lots of people aren't familiar with this situation it would be a good addition to (somewhere?) in the docs. I'm not sure where. |
Beta Was this translation helpful? Give feedback.
Hi @JayQ1982 - This is the same situation as on a normal server environment, where you have a reverse proxy in front of your web server. In DDEV, the ddev-router accepts traffic on 443 and proxies it to the ddev-webserver on port 80. If you want to know the actual URLs in any environment, you'll want to use the X_ variables, in your case HTTP_X_FORWARDED_PORT and HTTP_X_FORWARDED_PROTO:
More architecture detail in https://ddev.readthedocs.io/en/stable/users/usage/architecture
This article might help too, https://serverfault.com/questions/256191/getting-correct-server-port-to-php-fpm-thro…