Socket Connection to node server from https gives mixed content errorSocket.io connection url?Getting Node-http-proxy to work with socket.io?Connecting to Nodejs/Socket.IO server with SSL (https) when listening to custom portConnect to Socket.io server from a Rails serverIssue in connecting Rails client to Node serverConnect to Heroku socket from another server/localhostCannot connect to socket io serverconnect socket.io android client through a reverse proxy server to socket serverCouldn't get any response from the web socket server

Can pay be witheld for hours cleaning up after closing time?

Is using a hyperlink to close a modal a poor design decision?

Which household object drew this pattern?

Sleeping solo in a double sleeping bag

What is the hex versus octal timeline?

LeetCode: Pascal's Triangle C#

What is the appropriate benchmark for a Long/Short VIX futures strategy?

Avoiding racist tropes in fantasy

What is wrong about this application of Kirchhoffs Current Law?

Shouldn't the "credit score" prevent Americans from going deeper and deeper into personal debt?

Accent on í misaligned in bibliography / citation

Why did MS-DOS applications built using Turbo Pascal fail to start with a division by zero error on faster systems?

The remote server returned an error: (401) Unauthorized: While uploading file in document library using App Based Token Authentication

When did G-d say to Yaakov that he will have 12 sons?

In the MCU, why does Mjölnir retain its enchantments after Ragnarok?

Did a flight controller ever answer Flight with a no-go?

Dealing with an extrovert co-worker

How to use "Du hast/ Du hattest'?

Why do all fields in a QFT transform like *irreducible* representations of some group?

I got kicked out from graduate school in the past. How do I include this on my CV?

How would one country purchase another?

What professions would a medieval village with a population of 100 need?

What brought these couples together?

Fancy String Replace



Socket Connection to node server from https gives mixed content error


Socket.io connection url?Getting Node-http-proxy to work with socket.io?Connecting to Nodejs/Socket.IO server with SSL (https) when listening to custom portConnect to Socket.io server from a Rails serverIssue in connecting Rails client to Node serverConnect to Heroku socket from another server/localhostCannot connect to socket io serverconnect socket.io android client through a reverse proxy server to socket serverCouldn't get any response from the web socket server






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have a website running on https and as part of new feature I created a nodejs+socket.io based conversation server.



I decided to host conversation server on separate AWS instance.
When I try to make socket connection from my main website (running on https) to conversation server (running on AWS static IP instance like http://123.123.45.56) then it does not establish socket connection properly and browser shows following error logged to console:



Mixed Content: The page at 'https://www.mydomain' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://123.123.45.56/socket.io/?payload=asdfkasdla'. This request has been blocked; the content must be served over HTTPS.


This is how I make the connection node server:



io.connect(chatServerURL,query: "payload=" + encryptedPayload,secure: false);


On conversation server I am routing all the traffic coming on port 80 with the route /socket.io to locally node server port and server as follows:



 RewriteEngine On
RewriteCond %REQUEST_URI ^/socket.io [NC]
RewriteCond %QUERY_STRING transport=websocket [NC]
RewriteRule /(.*) ws://localhost:3000/$1 [P,L]

ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/


What should I do to make it work?
I don't have domain to use just for chat server and then assign ssl to that domain. I know that should not be the way to make it work.



What is the solution to it?










share|improve this question


























  • Broadly speaking, the solution is not to make a request to an insecure http: or ws: websocket service (instead you must connect to an https: or wss: service). How you go about making your existing service use https:/wss: (or finding a new service that does) depends on the particulars of the service you're connecting to (or your criteria for selecting a new service with the support you need). The other solution is to make your top-level page insecure, and stop serving your current page via HTTPS.

    – apsillers
    Mar 27 at 17:04

















0















I have a website running on https and as part of new feature I created a nodejs+socket.io based conversation server.



I decided to host conversation server on separate AWS instance.
When I try to make socket connection from my main website (running on https) to conversation server (running on AWS static IP instance like http://123.123.45.56) then it does not establish socket connection properly and browser shows following error logged to console:



Mixed Content: The page at 'https://www.mydomain' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://123.123.45.56/socket.io/?payload=asdfkasdla'. This request has been blocked; the content must be served over HTTPS.


This is how I make the connection node server:



io.connect(chatServerURL,query: "payload=" + encryptedPayload,secure: false);


On conversation server I am routing all the traffic coming on port 80 with the route /socket.io to locally node server port and server as follows:



 RewriteEngine On
RewriteCond %REQUEST_URI ^/socket.io [NC]
RewriteCond %QUERY_STRING transport=websocket [NC]
RewriteRule /(.*) ws://localhost:3000/$1 [P,L]

ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/


What should I do to make it work?
I don't have domain to use just for chat server and then assign ssl to that domain. I know that should not be the way to make it work.



What is the solution to it?










share|improve this question


























  • Broadly speaking, the solution is not to make a request to an insecure http: or ws: websocket service (instead you must connect to an https: or wss: service). How you go about making your existing service use https:/wss: (or finding a new service that does) depends on the particulars of the service you're connecting to (or your criteria for selecting a new service with the support you need). The other solution is to make your top-level page insecure, and stop serving your current page via HTTPS.

    – apsillers
    Mar 27 at 17:04













0












0








0








I have a website running on https and as part of new feature I created a nodejs+socket.io based conversation server.



I decided to host conversation server on separate AWS instance.
When I try to make socket connection from my main website (running on https) to conversation server (running on AWS static IP instance like http://123.123.45.56) then it does not establish socket connection properly and browser shows following error logged to console:



Mixed Content: The page at 'https://www.mydomain' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://123.123.45.56/socket.io/?payload=asdfkasdla'. This request has been blocked; the content must be served over HTTPS.


This is how I make the connection node server:



io.connect(chatServerURL,query: "payload=" + encryptedPayload,secure: false);


On conversation server I am routing all the traffic coming on port 80 with the route /socket.io to locally node server port and server as follows:



 RewriteEngine On
RewriteCond %REQUEST_URI ^/socket.io [NC]
RewriteCond %QUERY_STRING transport=websocket [NC]
RewriteRule /(.*) ws://localhost:3000/$1 [P,L]

ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/


What should I do to make it work?
I don't have domain to use just for chat server and then assign ssl to that domain. I know that should not be the way to make it work.



What is the solution to it?










share|improve this question
















I have a website running on https and as part of new feature I created a nodejs+socket.io based conversation server.



I decided to host conversation server on separate AWS instance.
When I try to make socket connection from my main website (running on https) to conversation server (running on AWS static IP instance like http://123.123.45.56) then it does not establish socket connection properly and browser shows following error logged to console:



Mixed Content: The page at 'https://www.mydomain' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://123.123.45.56/socket.io/?payload=asdfkasdla'. This request has been blocked; the content must be served over HTTPS.


This is how I make the connection node server:



io.connect(chatServerURL,query: "payload=" + encryptedPayload,secure: false);


On conversation server I am routing all the traffic coming on port 80 with the route /socket.io to locally node server port and server as follows:



 RewriteEngine On
RewriteCond %REQUEST_URI ^/socket.io [NC]
RewriteCond %QUERY_STRING transport=websocket [NC]
RewriteRule /(.*) ws://localhost:3000/$1 [P,L]

ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/


What should I do to make it work?
I don't have domain to use just for chat server and then assign ssl to that domain. I know that should not be the way to make it work.



What is the solution to it?







javascript node.js websocket socket.io reverse-proxy






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 27 at 16:54







Hammad

















asked Mar 27 at 16:48









HammadHammad

1,4282 gold badges13 silver badges30 bronze badges




1,4282 gold badges13 silver badges30 bronze badges















  • Broadly speaking, the solution is not to make a request to an insecure http: or ws: websocket service (instead you must connect to an https: or wss: service). How you go about making your existing service use https:/wss: (or finding a new service that does) depends on the particulars of the service you're connecting to (or your criteria for selecting a new service with the support you need). The other solution is to make your top-level page insecure, and stop serving your current page via HTTPS.

    – apsillers
    Mar 27 at 17:04

















  • Broadly speaking, the solution is not to make a request to an insecure http: or ws: websocket service (instead you must connect to an https: or wss: service). How you go about making your existing service use https:/wss: (or finding a new service that does) depends on the particulars of the service you're connecting to (or your criteria for selecting a new service with the support you need). The other solution is to make your top-level page insecure, and stop serving your current page via HTTPS.

    – apsillers
    Mar 27 at 17:04
















Broadly speaking, the solution is not to make a request to an insecure http: or ws: websocket service (instead you must connect to an https: or wss: service). How you go about making your existing service use https:/wss: (or finding a new service that does) depends on the particulars of the service you're connecting to (or your criteria for selecting a new service with the support you need). The other solution is to make your top-level page insecure, and stop serving your current page via HTTPS.

– apsillers
Mar 27 at 17:04





Broadly speaking, the solution is not to make a request to an insecure http: or ws: websocket service (instead you must connect to an https: or wss: service). How you go about making your existing service use https:/wss: (or finding a new service that does) depends on the particulars of the service you're connecting to (or your criteria for selecting a new service with the support you need). The other solution is to make your top-level page insecure, and stop serving your current page via HTTPS.

– apsillers
Mar 27 at 17:04












1 Answer
1






active

oldest

votes


















0















This might help someone in the future for right approach.
The way to do this is to send socket connection to same server i.e the one on running on https and then use reverse proxy there to proxy socket request to different machine running on http (running the node+socket.io server).



On Apache server I need to enable modules proxy and proxy_http and add these directives in apache virtual host configuration:



ProxyPass /socket.io/ http://123.45.56.67/socket.io
ProxyPassReverse /socket.io/ http://123.45.56.67/socket.io


There are lot resources online for that, I was just unaware of this proxying thing.
That's the way to do it.






share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    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
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55382527%2fsocket-connection-to-node-server-from-https-gives-mixed-content-error%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0















    This might help someone in the future for right approach.
    The way to do this is to send socket connection to same server i.e the one on running on https and then use reverse proxy there to proxy socket request to different machine running on http (running the node+socket.io server).



    On Apache server I need to enable modules proxy and proxy_http and add these directives in apache virtual host configuration:



    ProxyPass /socket.io/ http://123.45.56.67/socket.io
    ProxyPassReverse /socket.io/ http://123.45.56.67/socket.io


    There are lot resources online for that, I was just unaware of this proxying thing.
    That's the way to do it.






    share|improve this answer





























      0















      This might help someone in the future for right approach.
      The way to do this is to send socket connection to same server i.e the one on running on https and then use reverse proxy there to proxy socket request to different machine running on http (running the node+socket.io server).



      On Apache server I need to enable modules proxy and proxy_http and add these directives in apache virtual host configuration:



      ProxyPass /socket.io/ http://123.45.56.67/socket.io
      ProxyPassReverse /socket.io/ http://123.45.56.67/socket.io


      There are lot resources online for that, I was just unaware of this proxying thing.
      That's the way to do it.






      share|improve this answer



























        0














        0










        0









        This might help someone in the future for right approach.
        The way to do this is to send socket connection to same server i.e the one on running on https and then use reverse proxy there to proxy socket request to different machine running on http (running the node+socket.io server).



        On Apache server I need to enable modules proxy and proxy_http and add these directives in apache virtual host configuration:



        ProxyPass /socket.io/ http://123.45.56.67/socket.io
        ProxyPassReverse /socket.io/ http://123.45.56.67/socket.io


        There are lot resources online for that, I was just unaware of this proxying thing.
        That's the way to do it.






        share|improve this answer













        This might help someone in the future for right approach.
        The way to do this is to send socket connection to same server i.e the one on running on https and then use reverse proxy there to proxy socket request to different machine running on http (running the node+socket.io server).



        On Apache server I need to enable modules proxy and proxy_http and add these directives in apache virtual host configuration:



        ProxyPass /socket.io/ http://123.45.56.67/socket.io
        ProxyPassReverse /socket.io/ http://123.45.56.67/socket.io


        There are lot resources online for that, I was just unaware of this proxying thing.
        That's the way to do it.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 28 at 6:14









        HammadHammad

        1,4282 gold badges13 silver badges30 bronze badges




        1,4282 gold badges13 silver badges30 bronze badges





















            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • 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%2fstackoverflow.com%2fquestions%2f55382527%2fsocket-connection-to-node-server-from-https-gives-mixed-content-error%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

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

            155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해