symfony / mercure

The Mercure Component allows to easily push updates to web browsers and other HTTP clients using the Mercure protocol.
https://symfony.com/doc/current/components/mercure.html
MIT License
414 stars 39 forks source link

Peer certificate cannot be authenticated with given CA certificates #66

Closed JulienSellier closed 3 years ago

JulienSellier commented 3 years ago

Hello there,

I'm trying to deploy my project on a "preproduction" environment and I got this error when publishing on Mercure Hub:

Peer certificate cannot be authenticated with given CA certificates for https://xxx

It's a "preproduction" environment so it's not important but we can't pass "verify_peer" option to HttpClient using the hub.

Can we add this option ? Should I open a PR ?

Thanks

zspine commented 3 years ago

I had the similar problem and solved it by changing the Caddyfile and using http in the local setup instead of https. (not the best solution but it works)

{
    auto_https disable_redirects
    # Debug
    {$DEBUG}
    # HTTP/3 support
    servers {
        protocol {
            experimental_http3
        }
    }
}
JulienSellier commented 3 years ago

I had the similar problem and solved it by changing the Caddyfile and using http in the local setup instead of https. (not the best solution but it works)

{
    auto_https disable_redirects
    # Debug
    {$DEBUG}
    # HTTP/3 support
    servers {
        protocol {
            experimental_http3
        }
    }
}

Thanks it's good to know but I have no access (or not easy access) to my "preproduction" server ; on my local setup I have no issue with the ssl certificate...

It's why I try to solve this problem on the code side.

I tried to extends or decorates but the Hub is final.... :/

JulienSellier commented 3 years ago

I found the solution, we can change HTTPClient's defaults values for "verify_peer" and "verify_host" for a specific environnement:

framework.yaml

framework:
    http_client:
        default_options:
            verify_host: false
            verify_peer: false