Strange subdomain dns error with laravel websites, only working with https for a specific root domain


  • | 1660 points

    I'm on Laragon 2.0.2 right now, using laravel 5.4.

    Here is my hosts file :

    127.0.0.1      localhost
    127.0.0.1      fr.bd2.dev
    127.0.0.1      en.bd2.dev
    127.0.0.1      de.bd2.dev
    127.0.0.1      auth.bd2.dev
    127.0.0.1      manager.bd2.dev
    127.0.0.1      admin.bd2.dev
    127.0.0.1      fr.testdomain.dev
    127.0.0.1      en.testdomain.dev
    127.0.0.1      de.testdomain.dev
    127.0.0.1      auth.testdomain.dev
    127.0.0.1      manager.testdomain.dev
    127.0.0.1      admin.testdomain.dev
    127.0.0.1      test.tools.dev
    127.0.0.1      bd2.dev                 #laragon magic!   
    127.0.0.1      testdomain.dev   #laragon magic!   
    127.0.0.1      tools.dev              #laragon magic!   
    

    It worked since a few months until yesterday night when I closed my computer.

    Today :

    • If I try to access any http://\*.bd2.dev, it sends me to C:\laragon\www\index.php (the phpinfo default one). Any subpage (http://\*.bd2.dev/anything) makes an Apache 404 (not a laravel one).

    • If I try to access any https://\*.bd2.dev it works normally...

    • The root http://bd2.dev is not affected

    I just don't get how it can happen overnight.

    What I explored so far :

    • I added a test.tools.dev hosts entry, and this one works normally.

    • I copied all files to bd2test.dev, and subdomains work normally.

    • I copied a working project (my tools.dev one) in the bd2 folder. My tools project has the same subdomains errors when under the bd2.dev domain.

    • To see if it was just the laragon magic failing, I installed a local dns server (Acrylic DNS Proxy), made it work, same results, only https works for the *.bd2.dev domain.

    Basically what I get is that whatever I put in the C:\laragon\www\bd2\ folder, dns won't work if not accessed through https. It's not dependent on the files i put into it, and it's not dependent of where the dns resolves.

    Anyone got any lead ? Because I don't have anymore ideas ...


  • administrators
    | 55180 points

    @Lelectrolux : If it worked for you before, I guess there was some changes in your browser. Try another browsers to see if it works.


  • | 1660 points

    @leokhoa Just tested it with the 3 major (FF, IE, Chrome), same results. Even in incognito mode.


  • administrators
    | 55180 points

    Strange! Do you have any Virtual Host file?


  • | 1660 points

    Strange! Do you have any Virtual Host file?

    Only the autogenerated ones.

    Here is auto.bd2.dev.conf :

    define ROOT "C:/laragon/www/bd2/public"
    define SITE "bd2.dev"
    
    <VirtualHost *:80> 
        DocumentRoot "${ROOT}"
        ServerName ${SITE}
    	ServerAlias *.${SITE}, a0020fc6.ngrok.io
        <Directory "${ROOT}">
            AllowOverride All
            Require all granted
        </Directory>
    </VirtualHost>
    
    <VirtualHost *:443>
        DocumentRoot "${ROOT}"
        ServerName ${SITE}
        ServerAlias *.${SITE}
        <Directory "${ROOT}">
            AllowOverride All
            Require all granted
        </Directory>
    
        SSLEngine on
        SSLCertificateFile      C:/laragon/etc/ssl/bd2.dev.crt
        SSLCertificateKeyFile   C:/laragon/etc/ssl/bd2.dev.key
     
    </VirtualHost>
    

    Here is auto.tools.dev.conf :

    define ROOT "C:/laragon/www/tools/public/"
    define SITE "tools.dev"
    
    <VirtualHost *:80> 
        DocumentRoot "${ROOT}"
        ServerName ${SITE}
        ServerAlias *.${SITE}
        <Directory "${ROOT}">
            AllowOverride All
            Require all granted
        </Directory>
    </VirtualHost>
    
    <VirtualHost *:443>
        DocumentRoot "${ROOT}"
        ServerName ${SITE}
        ServerAlias *.${SITE}
        <Directory "${ROOT}">
            AllowOverride All
            Require all granted
        </Directory>
    
        SSLEngine on
        SSLCertificateFile      C:/laragon/etc/ssl/tools.dev.crt
        SSLCertificateKeyFile   C:/laragon/etc/ssl/tools.dev.key
     
    </VirtualHost>

  • | 1660 points

    @leokhoa You probably got it !

    I removed the , a0020fc6.ngrok.io in the auto.bd2.dev.conf and it seems to work now.

    Doing some checks, and I'll tell you if it is resolved.


  • | 1660 points

    I don't know if it's you or me, but topic can be marked as resolved.

    Thanks a lot @leokhoa. Wouldn't have caught it.

    Now, I can ask myself when did I ngrok that site, I have no memories of it.

    Still, it is some crazy side effects.


  • administrators
    | 55180 points

    @Lelectrolux : When you click the Share Menu, Laragon will generate an ngrok url so you can share your project with the world. It is no harm if it is there but I'm glad that your problem has been solved by removing it.
    I'll mark the topic as Solved :relaxed: . Cheer!


  • | 1660 points

    @leokhoa

    When you click the Share Menu, Laragon will generate an ngrok url so you can share your project with the world.

    Yeah used that in the past, but never for that very project (not near completion at all).

    It is no harm if it is there but I'm glad that your problem has been solved by removing it.

    I guess ngrok and all doesn't play well with subdomain routing anyway.

    Still, thanks for the help !

    And I'm amazed by how fast you answer ! :clap: :clap: :clap:


Log in to reply
 

Looks like your connection to Laragon was lost, please wait while we try to reconnect.