Thanks for your quick answer Jesse but i got the following error below;
01:12:59.517 [error] Error in process <0.332.0> on node
'asksomething@mert-VirtualBox' with exit value:
{function_clause,[{cowboy_protocol,parse_method,[<<0
bytes>>,{state,#Port<0.21796>,ranch_tcp,[cowboy_router,cowboy_handler],false,[{listener,boss_http_listener},{dispatch,[{'_',[],[{[<<6
bytes>>,'...'],[],cowboy_static,{priv_dir,asksomething,"stat...
01:12:59.517 [error] Ranch listener boss_http_listener had connection
process started with cowboy_protocol:start_link/4 at <0.332.0> exit with
reason:
{function_clause,[{cowboy_protocol,parse_method,[<<>>,{state,#Port<0.21796>,ranch_tcp,[cowboy_router,cowboy_handler],false,[{listener,boss_http_listener},{dispatch,[{'_',[],[{[<<"static">>,'...'],[],cowboy_static,{priv_dir,asksomething,"static",[{mimetypes,cow_mimetypes,all}]}},{'_',[],boss_mochicow_handler,[{loop,{boss_mochicow_handler,loop,[boss_router]}}]}]}]}],undefined,undefined,5,1,100,4096,64,4096,100,5000,1429654384516},<<22,3,0,0,63,1,0,0,59,3,0,152,18,167,190,88,63,47,160,44,156,120,240,152,9,65,24,101,186,210,223,65,176,97,215,88,2,120,66,207,77,230,223,0,0,20,0,255,86,0,0,51,0,50,0,57,0,47,0,53,0,10,0,5,0,4,1,0>>],[{file,"src/cowboy_protocol.erl"},{line,168}]}]}
Mert
22 Nisan 2015 Çarşamba 00:58:23 UTC+3 tarihinde Jesse Gumm yazdı:
>
> The problem here is that you're trying to establish an insecure
> websocket connection from a secure page - the browser won't like it,
> and then your :8001 connection is not a secured connection.
>
> You're much better off here using nginx to proxy the websocket
> connection. If you modify your "location /" rule to add the following
> lines:
>
> proxy_http_version 1.1;
> proxy_set_header X-Forwarded-For $remote_addr;
> proxy_set_header Upgrade $http_upgrade;
> proxy_set_header Connection "upgrade";
>
> This *should* allow the websocket connection to succeed with nginx
> proxying it.
>
> -Jesse
>
> On Tue, Apr 21, 2015 at 4:51 PM, Mert Öztürk <[email protected]
> <javascript:>> wrote:
> > Hello,
> >
> > I set up my cb app under nginx on vps. It is working fine with the path
> i
> > followed from here:
> https://github.com/ChicagoBoss/ChicagoBoss/wiki/Deploy
> > Now i am trying to set up ssl on nginx and try to establish websocket
> > handshake between the cb app.
> > My nginx default file looks like below;
> >
> > server {
> > listen 80 default;
> > listen [::]:80 default_server ipv6only=on;
> >
> > listen 443 ssl;
> >
> > root /usr/share/nginx/html;
> > index index.html index.htm;
> >
> > # Make site accessible from http://localhost/
> > server_name localhost;
> >
> > ssl_certificate /etc/nginx/ssl/nginx.crt;
> > ssl_certificate_key /etc/nginx/ssl/nginx.key;
> >
> > location / {
> > proxy_pass http://127.0.0.1:8001;
> > proxy_redirect off;
> > proxy_set_header Host $host;
> > proxy_set_header X-Real-IP $remote_addr;
> > proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
> > }
> >
> > When i start the application it gives me the error below;
> > [blocked] The page at 'https://localhost/' was loaded over HTTPS, but
> ran
> > insecure content from 'ws://localhost:8001/websocket/ask_service': this
> > content should also be loaded over HTTPS.
> > ask_something.js:53 Uncaught SecurityError: Failed to construct
> 'WebSocket':
> > An insecure WebSocket connection may not be initiated from a page loaded
> > over HTTPS.
> >
> > Then i change the line in js file from: wsHost =
> > "ws://localhost:8001/websocket/myWebsocket to wsHost =
> > "wss://localhost:8001/websocket/myWebsocket
> >
> > After this change, error message become like this;
> > WebSocket connection to 'wss://localhost:8001/websocket/ask_service'
> failed:
> > Error in connection establishment: net::ERR_CONNECTION_CLOSED
> >
> > (Also when i change {ssl_enable, true} in boss.config, app crashes. My
> app
> > is working with cowboy)
> >
> > Is there anyone who implemented ssl with a cb app working with websocket
> > before?
> >
> >
> > Thanks
> > Mert
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups
> > "ChicagoBoss" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an
> > email to [email protected] <javascript:>.
> > Visit this group at http://groups.google.com/group/chicagoboss.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/chicagoboss/46c7bf7e-6699-46c3-95e5-b6cfc3783770%40googlegroups.com.
>
>
> > For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> Jesse Gumm
> Owner, Sigma Star Systems
> 414.940.4866 || sigma-star.com || @jessegumm
>
--
You received this message because you are subscribed to the Google Groups
"ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at http://groups.google.com/group/chicagoboss.
To view this discussion on the web visit
https://groups.google.com/d/msgid/chicagoboss/ab03519b-7ae1-4aad-8af1-e61ae038768a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.