Accesing localhost via IP from another device Ubuntu [closed]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












I'm running localhost server on Ubuntu with xampp.
I want to access that server from another device within the same network.
To achieve that i'm using host IP adress from local network which is 192.168.150.250.



When i'm entering 192.168.150.250 from another device than localhost content is loaded and now i can see the xampp dashboard. When i'm trying to get into subdirectory of host. E.g 192.168.150.250/my-site url is instantly redirected into localhost/my-site.



What's strange not all the devices are redirected. For example my iOS device is not changing IP adress for localhost but my laptop does. I thought it may be caused by firewall so i disable it using :
sudo ufw disable
Now it's getting very interesting because this setting enabled my laptop Explorer browser to connect with my host, but in the same laptop Chrome browser is still redirecting site from IP to localhost.



My etc/hosts file



127.0.0.1 localhost
127.0.1.1 Ubuntu-X

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters


What can cause this strange redirects? Why it's working on some devices and browsers when it doesn't on others?







share|improve this question














closed as too broad by Rui F Ribeiro, schily, Thomas, Thomas Dickey, Isaac Aug 25 at 20:53


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


















    up vote
    2
    down vote

    favorite












    I'm running localhost server on Ubuntu with xampp.
    I want to access that server from another device within the same network.
    To achieve that i'm using host IP adress from local network which is 192.168.150.250.



    When i'm entering 192.168.150.250 from another device than localhost content is loaded and now i can see the xampp dashboard. When i'm trying to get into subdirectory of host. E.g 192.168.150.250/my-site url is instantly redirected into localhost/my-site.



    What's strange not all the devices are redirected. For example my iOS device is not changing IP adress for localhost but my laptop does. I thought it may be caused by firewall so i disable it using :
    sudo ufw disable
    Now it's getting very interesting because this setting enabled my laptop Explorer browser to connect with my host, but in the same laptop Chrome browser is still redirecting site from IP to localhost.



    My etc/hosts file



    127.0.0.1 localhost
    127.0.1.1 Ubuntu-X

    # The following lines are desirable for IPv6 capable hosts
    ::1 ip6-localhost ip6-loopback
    fe00::0 ip6-localnet
    ff00::0 ip6-mcastprefix
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters


    What can cause this strange redirects? Why it's working on some devices and browsers when it doesn't on others?







    share|improve this question














    closed as too broad by Rui F Ribeiro, schily, Thomas, Thomas Dickey, Isaac Aug 25 at 20:53


    Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
















      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      I'm running localhost server on Ubuntu with xampp.
      I want to access that server from another device within the same network.
      To achieve that i'm using host IP adress from local network which is 192.168.150.250.



      When i'm entering 192.168.150.250 from another device than localhost content is loaded and now i can see the xampp dashboard. When i'm trying to get into subdirectory of host. E.g 192.168.150.250/my-site url is instantly redirected into localhost/my-site.



      What's strange not all the devices are redirected. For example my iOS device is not changing IP adress for localhost but my laptop does. I thought it may be caused by firewall so i disable it using :
      sudo ufw disable
      Now it's getting very interesting because this setting enabled my laptop Explorer browser to connect with my host, but in the same laptop Chrome browser is still redirecting site from IP to localhost.



      My etc/hosts file



      127.0.0.1 localhost
      127.0.1.1 Ubuntu-X

      # The following lines are desirable for IPv6 capable hosts
      ::1 ip6-localhost ip6-loopback
      fe00::0 ip6-localnet
      ff00::0 ip6-mcastprefix
      ff02::1 ip6-allnodes
      ff02::2 ip6-allrouters


      What can cause this strange redirects? Why it's working on some devices and browsers when it doesn't on others?







      share|improve this question














      I'm running localhost server on Ubuntu with xampp.
      I want to access that server from another device within the same network.
      To achieve that i'm using host IP adress from local network which is 192.168.150.250.



      When i'm entering 192.168.150.250 from another device than localhost content is loaded and now i can see the xampp dashboard. When i'm trying to get into subdirectory of host. E.g 192.168.150.250/my-site url is instantly redirected into localhost/my-site.



      What's strange not all the devices are redirected. For example my iOS device is not changing IP adress for localhost but my laptop does. I thought it may be caused by firewall so i disable it using :
      sudo ufw disable
      Now it's getting very interesting because this setting enabled my laptop Explorer browser to connect with my host, but in the same laptop Chrome browser is still redirecting site from IP to localhost.



      My etc/hosts file



      127.0.0.1 localhost
      127.0.1.1 Ubuntu-X

      # The following lines are desirable for IPv6 capable hosts
      ::1 ip6-localhost ip6-loopback
      fe00::0 ip6-localnet
      ff00::0 ip6-mcastprefix
      ff02::1 ip6-allnodes
      ff02::2 ip6-allrouters


      What can cause this strange redirects? Why it's working on some devices and browsers when it doesn't on others?









      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 24 at 13:16









      GAD3R

      22.7k154895




      22.7k154895










      asked Aug 24 at 10:53









      Bartosz Was A.K.A Friiz

      212




      212




      closed as too broad by Rui F Ribeiro, schily, Thomas, Thomas Dickey, Isaac Aug 25 at 20:53


      Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






      closed as too broad by Rui F Ribeiro, schily, Thomas, Thomas Dickey, Isaac Aug 25 at 20:53


      Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






















          3 Answers
          3






          active

          oldest

          votes

















          up vote
          3
          down vote













          When a web server is processing dynamically-generated pages and needs to generate a fully-qualified URL that refers back to itself, it needs to know what to put into the hostname/address part of the URL.



          If there is nothing more specific defined, the default is usually "localhost" because it's the safe choice, and it works for quick test setups that are intended to be accessible only locally.



          When you need the server to be accessible from other devices too, the "proper" way to do it would be to make sure the server has a name that is resolvable by the other devices, and then use that name in ServerName directive in the main server and/or VirtualHost parts of your Apache configuration.



          An alternative solution would be to set UseCanonicalName Off in Apache configuration: when you do that, Apache will create self-referential URLs dynamically by using whatever name or IP address the client used to reach the server in the first place.



          The URL generation may also be happening within a PHP- or Perl-based web application; in that case, the application probably has its own configuration settings for that.






          share|improve this answer



























            up vote
            1
            down vote













            Problem solved.



            The issue here was my browsers and their cached files. After cleaning cache or going strictly to private browsing mode - page is displayed correctly.






            share|improve this answer



























              up vote
              0
              down vote













              my-site is doing this redirection...



              Maybe because something at the source code of my-site, that is configured to use localhost or because a .htaccess inside my-site.






              share|improve this answer



























                3 Answers
                3






                active

                oldest

                votes








                3 Answers
                3






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes








                up vote
                3
                down vote













                When a web server is processing dynamically-generated pages and needs to generate a fully-qualified URL that refers back to itself, it needs to know what to put into the hostname/address part of the URL.



                If there is nothing more specific defined, the default is usually "localhost" because it's the safe choice, and it works for quick test setups that are intended to be accessible only locally.



                When you need the server to be accessible from other devices too, the "proper" way to do it would be to make sure the server has a name that is resolvable by the other devices, and then use that name in ServerName directive in the main server and/or VirtualHost parts of your Apache configuration.



                An alternative solution would be to set UseCanonicalName Off in Apache configuration: when you do that, Apache will create self-referential URLs dynamically by using whatever name or IP address the client used to reach the server in the first place.



                The URL generation may also be happening within a PHP- or Perl-based web application; in that case, the application probably has its own configuration settings for that.






                share|improve this answer
























                  up vote
                  3
                  down vote













                  When a web server is processing dynamically-generated pages and needs to generate a fully-qualified URL that refers back to itself, it needs to know what to put into the hostname/address part of the URL.



                  If there is nothing more specific defined, the default is usually "localhost" because it's the safe choice, and it works for quick test setups that are intended to be accessible only locally.



                  When you need the server to be accessible from other devices too, the "proper" way to do it would be to make sure the server has a name that is resolvable by the other devices, and then use that name in ServerName directive in the main server and/or VirtualHost parts of your Apache configuration.



                  An alternative solution would be to set UseCanonicalName Off in Apache configuration: when you do that, Apache will create self-referential URLs dynamically by using whatever name or IP address the client used to reach the server in the first place.



                  The URL generation may also be happening within a PHP- or Perl-based web application; in that case, the application probably has its own configuration settings for that.






                  share|improve this answer






















                    up vote
                    3
                    down vote










                    up vote
                    3
                    down vote









                    When a web server is processing dynamically-generated pages and needs to generate a fully-qualified URL that refers back to itself, it needs to know what to put into the hostname/address part of the URL.



                    If there is nothing more specific defined, the default is usually "localhost" because it's the safe choice, and it works for quick test setups that are intended to be accessible only locally.



                    When you need the server to be accessible from other devices too, the "proper" way to do it would be to make sure the server has a name that is resolvable by the other devices, and then use that name in ServerName directive in the main server and/or VirtualHost parts of your Apache configuration.



                    An alternative solution would be to set UseCanonicalName Off in Apache configuration: when you do that, Apache will create self-referential URLs dynamically by using whatever name or IP address the client used to reach the server in the first place.



                    The URL generation may also be happening within a PHP- or Perl-based web application; in that case, the application probably has its own configuration settings for that.






                    share|improve this answer












                    When a web server is processing dynamically-generated pages and needs to generate a fully-qualified URL that refers back to itself, it needs to know what to put into the hostname/address part of the URL.



                    If there is nothing more specific defined, the default is usually "localhost" because it's the safe choice, and it works for quick test setups that are intended to be accessible only locally.



                    When you need the server to be accessible from other devices too, the "proper" way to do it would be to make sure the server has a name that is resolvable by the other devices, and then use that name in ServerName directive in the main server and/or VirtualHost parts of your Apache configuration.



                    An alternative solution would be to set UseCanonicalName Off in Apache configuration: when you do that, Apache will create self-referential URLs dynamically by using whatever name or IP address the client used to reach the server in the first place.



                    The URL generation may also be happening within a PHP- or Perl-based web application; in that case, the application probably has its own configuration settings for that.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Aug 24 at 11:51









                    telcoM

                    11.2k11333




                    11.2k11333






















                        up vote
                        1
                        down vote













                        Problem solved.



                        The issue here was my browsers and their cached files. After cleaning cache or going strictly to private browsing mode - page is displayed correctly.






                        share|improve this answer
























                          up vote
                          1
                          down vote













                          Problem solved.



                          The issue here was my browsers and their cached files. After cleaning cache or going strictly to private browsing mode - page is displayed correctly.






                          share|improve this answer






















                            up vote
                            1
                            down vote










                            up vote
                            1
                            down vote









                            Problem solved.



                            The issue here was my browsers and their cached files. After cleaning cache or going strictly to private browsing mode - page is displayed correctly.






                            share|improve this answer












                            Problem solved.



                            The issue here was my browsers and their cached files. After cleaning cache or going strictly to private browsing mode - page is displayed correctly.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Aug 24 at 13:11









                            Bartosz Was A.K.A Friiz

                            212




                            212




















                                up vote
                                0
                                down vote













                                my-site is doing this redirection...



                                Maybe because something at the source code of my-site, that is configured to use localhost or because a .htaccess inside my-site.






                                share|improve this answer
























                                  up vote
                                  0
                                  down vote













                                  my-site is doing this redirection...



                                  Maybe because something at the source code of my-site, that is configured to use localhost or because a .htaccess inside my-site.






                                  share|improve this answer






















                                    up vote
                                    0
                                    down vote










                                    up vote
                                    0
                                    down vote









                                    my-site is doing this redirection...



                                    Maybe because something at the source code of my-site, that is configured to use localhost or because a .htaccess inside my-site.






                                    share|improve this answer












                                    my-site is doing this redirection...



                                    Maybe because something at the source code of my-site, that is configured to use localhost or because a .htaccess inside my-site.







                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Aug 24 at 11:24









                                    Luciano Andress Martini

                                    3,118828




                                    3,118828












                                        Comments

                                        Popular posts from this blog

                                        What does second last employer means? [closed]

                                        List of Gilmore Girls characters

                                        Confectionery