Closed jacobcassidy closed 2 months ago
This has absolutely nothing to do with nginx-proxy.
I compared: php:8.0-apache which is using: curl 7.74.0 php:8.1-apache which is using: curl 7.88.1 (both really old btw)
And your reason seems to be a change in CURL:
Starting in commit 1a0ebf6632f8, to be released in curl 7.78.0, curl now treats the host name “localhost” specially and will use an internal “hard-coded” set of addresses for it – the ones we typically use for the loopback device: 127.0.0.1 and ::1. It cannot be modified by /etc/hosts and it cannot be accidentally or deliberately tricked by DNS resolves. localhost will now always resolve to a local address!
https://daniel.haxx.se/blog/2021/05/31/curl-localhost-as-a-local-host/
And because you are using .localhost in your DNS entry this is exactly what happens.
Try changing .localhost
to something random like .ltd
I just tested with your compose and that works fine.
Or use the name / alias of the docker container, as Docker DNS automatically makes internal entries for each service. So curl -v https://nginx-proxy
points to your nginx-proxy container without adjusting anything manually.
@SchoNie Thank you for the detailed follow-up! I'll close the issue since it's not related to nginx-proxy.
Using nginx-proxy version : 1.5.1-28-g94fb845
The Issue:
When trying to connect to the server within a PHP container using cURL (such as
curl—v https://test-server.localhost
), the connection breaks if you use a PHP version higher than 8.0.I first noticed this issue when building a WordPress container and the REST API couldn't connect. I pinpointed the issue being related to the PHP version as using PHP 8.0 works as expected. One big difference between PHP 8.0 and 8.1+ is that 8.0 uses OpenSSL 1.1.1 while 8.1 uses OpenSSL 3.0.11, so I suspect that may be the culprit, which nginx-proxy may need to update a configuration to fix.
Bash Output in the PHP container
Using PHP 8.1:
Using PHP 8.0 (ignore the CA problem... the server is reachable):
Reproduction:
Using the following file structure (and running
docker compose up -d
:NGINX Conf