dunglas / mercure

🪽 An open, easy, fast, reliable and battery-efficient solution for real-time communications
https://mercure.rocks
GNU Affero General Public License v3.0
3.83k stars 278 forks source link

"Update published" doesn't get sent to the client #916

Closed atzen88 closed 2 weeks ago

atzen88 commented 3 weeks ago

I got mercure running on a vserver with plesk. It uses apache and nginx as a reverse proxy.

I installed the mercure-legacy build without using any cady.file like i do it on my local wsl

I run mercure "successfully" with the following command:

/var/www/mercure/mercure --jwt-key='my-key' --addr='localhost:3000' --allow-anonymous --cors-allowed-origins='*' -f 

And also tried:

/var/www/mercure/mercure --jwt-key='my-key' --addr=':3000' --allow-anonymous --cors-allowed-origins='*' -f 

In case of mercure the apache server should not be called because I configured nginx to redirect all request direclty to mercure.

location /hub/ {
    proxy_pass http://localhost:3000/;
    proxy_read_timeout 24h;
    proxy_http_version 1.1;
    proxy_set_header Connection "";

    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-Proto $scheme;
}

And everything works fine: I get no errors, mercure is running, published updates are shown in the console and the update_topics fits the subscribed topics but the update does not reach the client.

The updates being published by an application written in symfony 7 using api-platform with mercure: true on one entity.

Subscriptions event triggered by a vue application look like this:

INFO[0035] New subscriber remote_addr={CLIENT_IP_ADDRESS} subscriber_topics="[https://my-url.com/api/some/topic]"

In symfony, when I use localhost (http://localhost:3000/.well-known/mercure) as MERCURE_URL I get this for a published update:

INFO[0053] Update published event_id=1234566 event_retry=0 event_type= remote_addr="127.0.0.1:44380" update_targets="[]" update_topics="[https://my-url.com/api/some/topic]"

When I use my domain (https://my-domain/hub/.well-known/mercure) it goes like this:

INFO[0048] Update published event_id=1234567 event_retry=0 event_type= remote_addr={SERVER_PUBLIC_IP} update_targets="[]" update_topics="[ https://my-url.com/api/some/topic]"

On my local machine everything work fine. The only difference i noticed is, that the following event is not triggered on the vhost but on my local machine:

INFO[0019] Event sent  event_id=ae8e2b79-7b3b-422a-9dc3-2870b5f6ed1b event_retry=0 event_type= last_event_id=681d9d42-b686-478a-bca9-b520a904a65e remote_addr="127.0.0.1:55100" subscriber_targets="[]" subscriber_topics="[https://localhost:8000/api/some/topic]" update_targets="[]" update_topics="[https://localhost:8000/api/some/topic]"

Thank you for your help in advance!

atzen88 commented 2 weeks ago

It is runnung with a Caddy based build including ssl, so i am closing this here