RangerMauve / hyperswarm-web

Implementation of the hyperswarm API for use in web browsers
MIT License
102 stars 15 forks source link

Decoded message is not valid #17

Closed itsdeka closed 3 years ago

itsdeka commented 3 years ago

I am stuck trying to setup the hypercore-web server for this project (https://github.com/itsdeka/dazaar-react-starter)

Server looks online

11 (36)

but when I interact with it from the react app it crashes

11 (37)

itsdeka commented 3 years ago

It works locally, it does not when it is served by nginx with wss

RangerMauve commented 3 years ago

Thanks for the bug report.

Sounds like it might be an nginx issue. 🤔

Here's a config that has worked for me in the past:

server {
  server_name mydatstore.my-pinning-server.com;

  location / {
    proxy_pass http://localhost:3472;
    proxy_set_header    Host            $host;
    proxy_set_header    X-Real-IP       $remote_addr;
    proxy_set_header    X-Forwarded-for $remote_addr;
    port_in_redirect    off;
    proxy_http_version  1.1;
    proxy_set_header    Upgrade         $http_upgrade;
    proxy_set_header    Connection      "Upgrade";
  }

    listen 80;
    listen [::]:80;

    listen [::]:443 ssl; # managed by Certbot
    listen 443 ssl; # managed by Certbot

    # ... Certbot managed cerificate stuff down here ...#
}

Does that help?

itsdeka commented 3 years ago

Great, it works! Thank you very much for your help

RangerMauve commented 3 years ago

Glad I could help.

A PR to the README that clarifies this would also be appreciated. 😁