how to setup secure websockets with nginx Announcing the arrival of Valued Associate #679:...

How do I stop a creek from eroding my steep embankment?

Single word antonym of "flightless"

What causes the vertical darker bands in my photo?

Is there a service that would inform me whenever a new direct route is scheduled from a given airport?

Is there a documented rationale why the House Ways and Means chairman can demand tax info?

Can a non-EU citizen traveling with me come with me through the EU passport line?

Do I really need recursive chmod to restrict access to a folder?

How much radiation do nuclear physics experiments expose researchers to nowadays?

WAN encapsulation

What are the pros and cons of Aerospike nosecones?

What do you call a plan that's an alternative plan in case your initial plan fails?

Bonus calculation: Am I making a mountain out of a molehill?

How to find all the available tools in macOS terminal?

Is there a concise way to say "all of the X, one of each"?

"Seemed to had" is it correct?

How do I mention the quality of my school without bragging

Did Kevin spill real chili?

What LEGO pieces have "real-world" functionality?

What happens to sewage if there is no river near by?

Why is "Consequences inflicted." not a sentence?

Does accepting a pardon have any bearing on trying that person for the same crime in a sovereign jurisdiction?

When to stop saving and start investing?

Is there a Spanish version of "dot your i's and cross your t's" that includes the letter 'ñ'?

How to draw this diagram using TikZ package?



how to setup secure websockets with nginx



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Come Celebrate our 10 Year Anniversary!Proxy HTTPS requests to a HTTP backend with NGINXsvn using nginx Commit failed: path not foundNginx proxy pass works for https but not httpnginx load balancer rewrite to listen portnginx proxy redirecting request to different proxyNginx subversion commit failureNginx/Apache: set HSTS only if X-Forwarded-Proto is httpsConfigure NGINX : How to handle 500 Error on upstream itself, While Nginx handle other 5xx errorsWebSockets + Apache and Nginx in “reverse proxy mode” + SSL/secureNginx reverse proxy to many local servers + webserver duty





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I have a webserver running on port 9000 I want to make it available on port 80, and also I want to make a websocket connection available on port 9021. If i run this over http everything works fine. But when I go to https the websocket cannot be connected.



Here's my nginx config: this gives the warning:



nginx: [warn] conflicting server name "oyun.net" on 0.0.0.0:443, ignored



server {
listen 443 ssl;
server_name oyun.net;
ssl_certificate /etc/key.pem
ssl_certificate_key /etc/key2.pem
listen 80;
location / {
proxy_pass http://localhost:9000
}
}

server {
listen 443 ssl;
server_name oyun.net;
ssl_certificate /etc/key.pem
ssl_certificate_key /etc/key2.pem
listen 9021;
location / {
proxy_pass http://localhost:9000;
proxy_http_version 1.1;
proxy_set_header upgrade $http_upgrade;
proxy_set_header connection "upgrade";
proxy_set_header x-real-ip $remote_addr;
proxy_set_header host $host;
proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;
}
}


Here's the browser error:



WebSocket connection to 'wss://oyun.net:9021/socket/v1?sri=tcylqwzjnl' failed: 

Error in connection establishment: net::ERR_SSL_PROTOCOL_ERROR








share







New contributor




gsssad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



























    0















    I have a webserver running on port 9000 I want to make it available on port 80, and also I want to make a websocket connection available on port 9021. If i run this over http everything works fine. But when I go to https the websocket cannot be connected.



    Here's my nginx config: this gives the warning:



    nginx: [warn] conflicting server name "oyun.net" on 0.0.0.0:443, ignored



    server {
    listen 443 ssl;
    server_name oyun.net;
    ssl_certificate /etc/key.pem
    ssl_certificate_key /etc/key2.pem
    listen 80;
    location / {
    proxy_pass http://localhost:9000
    }
    }

    server {
    listen 443 ssl;
    server_name oyun.net;
    ssl_certificate /etc/key.pem
    ssl_certificate_key /etc/key2.pem
    listen 9021;
    location / {
    proxy_pass http://localhost:9000;
    proxy_http_version 1.1;
    proxy_set_header upgrade $http_upgrade;
    proxy_set_header connection "upgrade";
    proxy_set_header x-real-ip $remote_addr;
    proxy_set_header host $host;
    proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;
    }
    }


    Here's the browser error:



    WebSocket connection to 'wss://oyun.net:9021/socket/v1?sri=tcylqwzjnl' failed: 

    Error in connection establishment: net::ERR_SSL_PROTOCOL_ERROR








    share







    New contributor




    gsssad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0








      I have a webserver running on port 9000 I want to make it available on port 80, and also I want to make a websocket connection available on port 9021. If i run this over http everything works fine. But when I go to https the websocket cannot be connected.



      Here's my nginx config: this gives the warning:



      nginx: [warn] conflicting server name "oyun.net" on 0.0.0.0:443, ignored



      server {
      listen 443 ssl;
      server_name oyun.net;
      ssl_certificate /etc/key.pem
      ssl_certificate_key /etc/key2.pem
      listen 80;
      location / {
      proxy_pass http://localhost:9000
      }
      }

      server {
      listen 443 ssl;
      server_name oyun.net;
      ssl_certificate /etc/key.pem
      ssl_certificate_key /etc/key2.pem
      listen 9021;
      location / {
      proxy_pass http://localhost:9000;
      proxy_http_version 1.1;
      proxy_set_header upgrade $http_upgrade;
      proxy_set_header connection "upgrade";
      proxy_set_header x-real-ip $remote_addr;
      proxy_set_header host $host;
      proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;
      }
      }


      Here's the browser error:



      WebSocket connection to 'wss://oyun.net:9021/socket/v1?sri=tcylqwzjnl' failed: 

      Error in connection establishment: net::ERR_SSL_PROTOCOL_ERROR








      share







      New contributor




      gsssad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I have a webserver running on port 9000 I want to make it available on port 80, and also I want to make a websocket connection available on port 9021. If i run this over http everything works fine. But when I go to https the websocket cannot be connected.



      Here's my nginx config: this gives the warning:



      nginx: [warn] conflicting server name "oyun.net" on 0.0.0.0:443, ignored



      server {
      listen 443 ssl;
      server_name oyun.net;
      ssl_certificate /etc/key.pem
      ssl_certificate_key /etc/key2.pem
      listen 80;
      location / {
      proxy_pass http://localhost:9000
      }
      }

      server {
      listen 443 ssl;
      server_name oyun.net;
      ssl_certificate /etc/key.pem
      ssl_certificate_key /etc/key2.pem
      listen 9021;
      location / {
      proxy_pass http://localhost:9000;
      proxy_http_version 1.1;
      proxy_set_header upgrade $http_upgrade;
      proxy_set_header connection "upgrade";
      proxy_set_header x-real-ip $remote_addr;
      proxy_set_header host $host;
      proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;
      }
      }


      Here's the browser error:



      WebSocket connection to 'wss://oyun.net:9021/socket/v1?sri=tcylqwzjnl' failed: 

      Error in connection establishment: net::ERR_SSL_PROTOCOL_ERROR






      nginx https





      share







      New contributor




      gsssad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share







      New contributor




      gsssad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share



      share






      New contributor




      gsssad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 3 mins ago









      gsssadgsssad

      1




      1




      New contributor




      gsssad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      gsssad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      gsssad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          0






          active

          oldest

          votes












          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "2"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          gsssad is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f963202%2fhow-to-setup-secure-websockets-with-nginx%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          gsssad is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          gsssad is a new contributor. Be nice, and check out our Code of Conduct.













          gsssad is a new contributor. Be nice, and check out our Code of Conduct.












          gsssad is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Server Fault!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f963202%2fhow-to-setup-secure-websockets-with-nginx%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          As a Security Precaution, the user account has been locked The Next CEO of Stack OverflowMS...

          117736 Шеррод Примітки | Див. також | Посилання | Навігаційне...

          Маріан Котлеба Зміст Життєпис | Політичні погляди |...