Access ddev web container from other hosts











up vote
0
down vote

favorite












I want to access the ddev web container from another host. How can I achieve this?



For example: ddev is running on host A, I want to access the web page from host B.










share|improve this question


























    up vote
    0
    down vote

    favorite












    I want to access the ddev web container from another host. How can I achieve this?



    For example: ddev is running on host A, I want to access the web page from host B.










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I want to access the ddev web container from another host. How can I achieve this?



      For example: ddev is running on host A, I want to access the web page from host B.










      share|improve this question













      I want to access the ddev web container from another host. How can I achieve this?



      For example: ddev is running on host A, I want to access the web page from host B.







      ddev






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 19 hours ago









      Chris

      576




      576
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          There is a good summary of techniques on https://medium.com/botfuel/how-to-expose-a-local-development-server-to-the-internet-c31532d741cc and I see a number of others - It suggests:




          • ngrok (See existing ddev issue)

          • localtunnel

          • Just proxying with an ssh tunnel.


          So there are at least two variants of what you're talking about:




          1. Just proxying to an exposed port on your host machine for access by another machine on your local network.

          2. Proxying your local development environment to a host on the internet for access from anywhere.


          For either approach, we need to figure out what port to proxy.
          If you can just use http, I'd proxy the localhost port (which goes directly to the web container and doesn't care what the hostname in the URL is). So if ddev describe shows http://d7git.ddev.local:8080, https://d7git.ddev.local:8443, http://127.0.0.1:32827, use the 127.0.0.1 port (32827 in this case). If you can do this, you won't have to fiddle with faking the hostname on the host from which you're going to access this.



          So for option 1 (just exposing on another port on your machine), use any of these technqiues. I'll use the socat approach on macOS (brew install socat).



          socat tcp-listen:8889,reuseaddr,fork tcp:localhost:32827



          where 32827 is the port listed by ddev describe as localhost access, and 8889 is the port you want to expose to others. Then find out your local network IP address (Use ifconfig or other techniques) and others can access your ddev project with that. For example, my setup today would be http://10.150.150.87:32827/



          For option 2, Proxying your project for somebody else to use on the internet, via ssh tunneling:



          ssh -R :9101:localhost:32827 user@host.example.com



          That will tunnel your local port 32827 (check your own ddev describe for this) to port 9101 on the remote host.example.com. Note that you'll likely have to




          • Change the firewall config to enable access to that port on the remote host

          • Enable GatewayPorts yes in the host's sshd config.






          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',
            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%2f53371087%2faccess-ddev-web-container-from-other-hosts%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








            up vote
            0
            down vote













            There is a good summary of techniques on https://medium.com/botfuel/how-to-expose-a-local-development-server-to-the-internet-c31532d741cc and I see a number of others - It suggests:




            • ngrok (See existing ddev issue)

            • localtunnel

            • Just proxying with an ssh tunnel.


            So there are at least two variants of what you're talking about:




            1. Just proxying to an exposed port on your host machine for access by another machine on your local network.

            2. Proxying your local development environment to a host on the internet for access from anywhere.


            For either approach, we need to figure out what port to proxy.
            If you can just use http, I'd proxy the localhost port (which goes directly to the web container and doesn't care what the hostname in the URL is). So if ddev describe shows http://d7git.ddev.local:8080, https://d7git.ddev.local:8443, http://127.0.0.1:32827, use the 127.0.0.1 port (32827 in this case). If you can do this, you won't have to fiddle with faking the hostname on the host from which you're going to access this.



            So for option 1 (just exposing on another port on your machine), use any of these technqiues. I'll use the socat approach on macOS (brew install socat).



            socat tcp-listen:8889,reuseaddr,fork tcp:localhost:32827



            where 32827 is the port listed by ddev describe as localhost access, and 8889 is the port you want to expose to others. Then find out your local network IP address (Use ifconfig or other techniques) and others can access your ddev project with that. For example, my setup today would be http://10.150.150.87:32827/



            For option 2, Proxying your project for somebody else to use on the internet, via ssh tunneling:



            ssh -R :9101:localhost:32827 user@host.example.com



            That will tunnel your local port 32827 (check your own ddev describe for this) to port 9101 on the remote host.example.com. Note that you'll likely have to




            • Change the firewall config to enable access to that port on the remote host

            • Enable GatewayPorts yes in the host's sshd config.






            share|improve this answer



























              up vote
              0
              down vote













              There is a good summary of techniques on https://medium.com/botfuel/how-to-expose-a-local-development-server-to-the-internet-c31532d741cc and I see a number of others - It suggests:




              • ngrok (See existing ddev issue)

              • localtunnel

              • Just proxying with an ssh tunnel.


              So there are at least two variants of what you're talking about:




              1. Just proxying to an exposed port on your host machine for access by another machine on your local network.

              2. Proxying your local development environment to a host on the internet for access from anywhere.


              For either approach, we need to figure out what port to proxy.
              If you can just use http, I'd proxy the localhost port (which goes directly to the web container and doesn't care what the hostname in the URL is). So if ddev describe shows http://d7git.ddev.local:8080, https://d7git.ddev.local:8443, http://127.0.0.1:32827, use the 127.0.0.1 port (32827 in this case). If you can do this, you won't have to fiddle with faking the hostname on the host from which you're going to access this.



              So for option 1 (just exposing on another port on your machine), use any of these technqiues. I'll use the socat approach on macOS (brew install socat).



              socat tcp-listen:8889,reuseaddr,fork tcp:localhost:32827



              where 32827 is the port listed by ddev describe as localhost access, and 8889 is the port you want to expose to others. Then find out your local network IP address (Use ifconfig or other techniques) and others can access your ddev project with that. For example, my setup today would be http://10.150.150.87:32827/



              For option 2, Proxying your project for somebody else to use on the internet, via ssh tunneling:



              ssh -R :9101:localhost:32827 user@host.example.com



              That will tunnel your local port 32827 (check your own ddev describe for this) to port 9101 on the remote host.example.com. Note that you'll likely have to




              • Change the firewall config to enable access to that port on the remote host

              • Enable GatewayPorts yes in the host's sshd config.






              share|improve this answer

























                up vote
                0
                down vote










                up vote
                0
                down vote









                There is a good summary of techniques on https://medium.com/botfuel/how-to-expose-a-local-development-server-to-the-internet-c31532d741cc and I see a number of others - It suggests:




                • ngrok (See existing ddev issue)

                • localtunnel

                • Just proxying with an ssh tunnel.


                So there are at least two variants of what you're talking about:




                1. Just proxying to an exposed port on your host machine for access by another machine on your local network.

                2. Proxying your local development environment to a host on the internet for access from anywhere.


                For either approach, we need to figure out what port to proxy.
                If you can just use http, I'd proxy the localhost port (which goes directly to the web container and doesn't care what the hostname in the URL is). So if ddev describe shows http://d7git.ddev.local:8080, https://d7git.ddev.local:8443, http://127.0.0.1:32827, use the 127.0.0.1 port (32827 in this case). If you can do this, you won't have to fiddle with faking the hostname on the host from which you're going to access this.



                So for option 1 (just exposing on another port on your machine), use any of these technqiues. I'll use the socat approach on macOS (brew install socat).



                socat tcp-listen:8889,reuseaddr,fork tcp:localhost:32827



                where 32827 is the port listed by ddev describe as localhost access, and 8889 is the port you want to expose to others. Then find out your local network IP address (Use ifconfig or other techniques) and others can access your ddev project with that. For example, my setup today would be http://10.150.150.87:32827/



                For option 2, Proxying your project for somebody else to use on the internet, via ssh tunneling:



                ssh -R :9101:localhost:32827 user@host.example.com



                That will tunnel your local port 32827 (check your own ddev describe for this) to port 9101 on the remote host.example.com. Note that you'll likely have to




                • Change the firewall config to enable access to that port on the remote host

                • Enable GatewayPorts yes in the host's sshd config.






                share|improve this answer














                There is a good summary of techniques on https://medium.com/botfuel/how-to-expose-a-local-development-server-to-the-internet-c31532d741cc and I see a number of others - It suggests:




                • ngrok (See existing ddev issue)

                • localtunnel

                • Just proxying with an ssh tunnel.


                So there are at least two variants of what you're talking about:




                1. Just proxying to an exposed port on your host machine for access by another machine on your local network.

                2. Proxying your local development environment to a host on the internet for access from anywhere.


                For either approach, we need to figure out what port to proxy.
                If you can just use http, I'd proxy the localhost port (which goes directly to the web container and doesn't care what the hostname in the URL is). So if ddev describe shows http://d7git.ddev.local:8080, https://d7git.ddev.local:8443, http://127.0.0.1:32827, use the 127.0.0.1 port (32827 in this case). If you can do this, you won't have to fiddle with faking the hostname on the host from which you're going to access this.



                So for option 1 (just exposing on another port on your machine), use any of these technqiues. I'll use the socat approach on macOS (brew install socat).



                socat tcp-listen:8889,reuseaddr,fork tcp:localhost:32827



                where 32827 is the port listed by ddev describe as localhost access, and 8889 is the port you want to expose to others. Then find out your local network IP address (Use ifconfig or other techniques) and others can access your ddev project with that. For example, my setup today would be http://10.150.150.87:32827/



                For option 2, Proxying your project for somebody else to use on the internet, via ssh tunneling:



                ssh -R :9101:localhost:32827 user@host.example.com



                That will tunnel your local port 32827 (check your own ddev describe for this) to port 9101 on the remote host.example.com. Note that you'll likely have to




                • Change the firewall config to enable access to that port on the remote host

                • Enable GatewayPorts yes in the host's sshd config.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 9 hours ago

























                answered 9 hours ago









                rfay

                1,106714




                1,106714






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53371087%2faccess-ddev-web-container-from-other-hosts%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

                    Wiesbaden

                    Marschland

                    Dieringhausen