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

Mercure call in browser is still pending #814

Open
etokas opened this issue Oct 3, 2023 · 7 comments
Open

Mercure call in browser is still pending #814

etokas opened this issue Oct 3, 2023 · 7 comments

Comments

@etokas
Copy link

etokas commented Oct 3, 2023

Hello everyone
I come to you because for 3 days I have been stuck on the mercure installation.

When I test locally everything works fine and when I deploy my application to production, in the browser the mercure call is still pending instead to 200 http code

Here is my nginx configuration which is behind a proxy

server {
    server_name api.example.com;

   location /.well-known/mercure {
          proxy_pass http://localhost:3000/.well-known/mercure;
          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;

          access_log    off;
     }


}

My docker configuration
(I used the same one locally, it works but not in production)

mercure:
    image: dunglas/mercure
    restart: unless-stopped
    environment:
      SERVER_NAME: ':3000'
      MERCURE_PUBLISHER_JWT_KEY: ${MERCURE_JWT_KEY}
      MERCURE_SUBSCRIBER_JWT_KEY: ${MERCURE_JWT_KEY}
      MERCURE_EXTRA_DIRECTIVES: |-
        cors_origins *
    volumes:
      - mercure_data:/data
      - mercure_config:/config
    ports:
      - '3000:3000'
volumes:
  mercure_data:
  mercure_config:

My .env

MERCURE_URL=https://localhost:3000/.well-known/mercure
MERCURE_PUBLIC_URL=https://api.example.com/.well-known/mercure
MERCURE_JWT_SECRET="uH/3/8B435IFflrNL0N5ewHrchuC2DkHhKC/bkg/LvRgfpWz2V1/m6BuUvVPVBPb"
MERCURE_JWT_KEY="uH/3/8B435IFflrNL0N5ewHrchuC2DkHhKC/bkg/LvRgfpWz2V1/m6BuUvVPVBPb"

Browser screenshot

Capture d’écran 2023-10-03 à 15 21 56

And my docker compose logs mercure

current-mercure-1  | 2023/10/03 13:30:29.370    INFO    http.log.access.log0    handled request {"request": {"remote_ip": "172.18.0.1", "remote_port": "49586", "client_ip": "172.18.0.1", "proto": "HTTP/1.1", "method": "GET", "host": "localhost:3000", "uri": "/.well-known/mercure?topic=%2Fradars%2Fexecutions%2Fupdate-null&topic=%2Fradars%2Fimport%2F5", "headers": {"X-Forwarded-Host": ["api.example.com"], "Sec-Ch-Ua": ["\"Google Chrome\";v=\"117\", \"Not;A=Brand\";v=\"8\", \"Chromium\";v=\"117\""], "Origin": ["https://api.example.com"], "Referer": ["https://api.example.com/"], "Accept-Language": ["fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7"], "X-Forwarded-For": ["176.186.106.81, 54.36.182.98"], "X-Forwarded-Port": ["443"], "Authorization": [], "Sec-Fetch-Site": ["same-site"], "Sec-Fetch-Mode": ["cors"], "Accept-Encoding": ["gzip, deflate, br"], "X-Forwarded-Proto": ["http"], "X-Real-Ip": ["176.186.106.81"], "Accept": ["text/event-stream"], "Sec-Ch-Ua-Mobile": ["?0"], "Sec-Ch-Ua-Platform": ["\"macOS\""], "Sec-Fetch-Dest": ["empty"], "Pragma": ["no-cache"], "Cache-Control": ["no-cache"], "User-Agent": ["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36"]}}, "bytes_read": 0, "user_id": "", "duration": 28.973428328, "size": 2, "status": 200, "resp_headers": {"X-Frame-Options": ["DENY"], "Access-Control-Allow-Credentials": ["true"], "Access-Control-Allow-Origin": ["*"], "Cache-Control": ["private, no-cache, no-store, must-revalidate, max-age=0"], "Expire": ["0"], "X-Accel-Buffering": ["no"], "Server": ["Caddy"], "X-Content-Type-Options": ["nosniff"], "X-Xss-Protection": ["1; mode=block"], "Content-Security-Policy": ["default-src 'self'"], "Connection": ["keep-alive"], "Content-Type": ["text/event-stream"], "Pragma": ["no-cache"]}}
current-mercure-1  | 2023/10/03 13:30:30.291    INFO    http.log.access.log0    handled request {"request": {"remote_ip": "172.18.0.1", "remote_port": "39498", "client_ip": "172.18.0.1", "proto": "HTTP/1.1", "method": "OPTIONS", "host": "localhost:3000", "uri": "/.well-known/mercure?topic=%2Fradars%2Fexecutions%2Fupdate-null&topic=%2Fradars%2Fimport%2F5", "headers": {"X-Forwarded-Host": ["api.example.com"], "X-Forwarded-Proto": ["http"], "Sec-Fetch-Site": ["same-site"], "Sec-Fetch-Dest": ["empty"], "Accept": ["*/*"], "Access-Control-Request-Method": ["GET"], "User-Agent": ["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36"], "X-Forwarded-For": ["176.186.106.81, 54.36.182.98"], "X-Real-Ip": ["176.186.106.81"], "X-Forwarded-Port": ["443"], "Cache-Control": ["no-cache"], "Sec-Fetch-Mode": ["cors"], "Accept-Language": ["fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7"], "Pragma": ["no-cache"], "Access-Control-Request-Headers": ["authorization"], "Origin": ["https://api.example.com"], "Referer": ["https://api.example.com/"], "Accept-Encoding": ["gzip, deflate, br"]}}, "bytes_read": 0, "user_id": "", "duration": 0.000040192, "size": 0, "status": 200, "resp_headers": {"Access-Control-Allow-Credentials": ["true"], "Access-Control-Allow-Origin": ["*"], "Server": ["Caddy"], "X-Frame-Options": ["DENY"], "X-Content-Type-Options": ["nosniff"], "X-Xss-Protection": ["1; mode=block"], "Content-Security-Policy": ["default-src 'self'"], "Access-Control-Allow-Headers": ["Authorization"]}}
current-mercure-1  | {"level":"info","ts":1696339830.3076267,"logger":"http.handlers.mercure","msg":"New subscriber","subscriber":{"id":"urn:uuid:e4a7a02a-9941-4dc9-a68e-27e45da27c79","last_event_id":"","remote_addr":"172.18.0.1:39506","topic_selectors":[],"topics":["/radars/executions/update-null","/radars/import/5"]}}

Thank you all for your help.

@etokas etokas changed the title Mercury call in browser is still pending Mercure call in browser is still pending Oct 3, 2023
@dunglas
Copy link
Owner

dunglas commented Oct 3, 2023

This line in .env looks suspicious: MERCURE_URL=https://localhost:3000/.well-known/mercure (it should probably be http://localhost:3000/.well-known/mercure).

If the project is open source, I'll be glad to take a look (if it's not, maybe can we continue privately to see how we can help you)!

@etokas
Copy link
Author

etokas commented Oct 3, 2023

Yess i try to keep http but it's the same.

@dunglas it's private project, I send you MP

Thank you again :)

@kl3sk
Copy link

kl3sk commented Dec 7, 2023

Hello,

Any advice you can say ? It look like I face a similar issue.

Thanks

@jeandanyel
Copy link

Hello,

I got the same issue on Digital Ocean's APP Platform; everything works properly in my local environment.

@dunglas
Copy link
Owner

dunglas commented Dec 7, 2023

Can you double-check that the HTTP connection between the client and the server is using HTTP/2 or HTTP/3 please?

@kl3sk
Copy link

kl3sk commented Dec 8, 2023

In my case it was not, but if I'm right HTTP/2 is only available with SSL ?
If so I have an other error

@dunglas
Copy link
Owner

dunglas commented Dec 8, 2023

Yes you need TLS for HTTP/2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants