leokhoa / laragon

Laragon is a portable, isolated, fast & powerful universal development environment for PHP, Node.js, Python, Java, Go, Ruby. It is fast, lightweight, easy-to-use and easy-to-extend.
https://laragon.org
4.39k stars 368 forks source link

Add rewriting the Host header attribute to Ngrok command #179

Open N1ebieski opened 4 years ago

N1ebieski commented 4 years ago

Ngrok works if folder project is simple like "test", but if name contains dots like "test.net.pl", then Ngrok uses default vhost - 00.default.conf and show Index of projects in root folder.

Solution is rewriting the Host header > https://ngrok.com/docs#http-host-header

improved-software commented 3 years ago

I've just spent a fair bit of time trying to get this to work from the ngrok config and seeing if the ngrok command was editable somewhere but it isn't.

-host-header=rewrite || Required for virtual hosts to work

ngrok http -config=c:\laragon\bin\ngrok\conf\my.custom.domain.yml -region=au -host-header=rewrite my.custom.domain:80

If Laragon ran a similar command to launch ngrok then custom virtual hosts would work. -host-header=rewrite is required

The best solution

Add the virtual host as a tunnel in the generated config file. Allows end users to customise all ngrok settings

c:\laragon\bin\ngrok\conf\my.custom.domain.yml

web_addr: localhost:4041
tunnels:
  laragon:
    addr: my.custom.domain:80
    proto: http
    host_header: rewrite

ngrok launch command ngrok start -config=c:\laragon\bin\ngrok\conf\my.custom.domain.yml -region=au laragon

leokhoa commented 3 years ago

@improved-software : Nice solution. I will add it to the TODO

improved-software commented 3 years ago

@leokhoa Glad it might be useful. Would make the share really powerful being able to configure each project as needed.


I really sincerely appreciate the work you have done with Laragon and making it available. I only came across it within the last year, but it's saving me a lot of time compared to my previous setup.

Definitely made a difference in my life, so thank you Sir ;)

leokhoa commented 3 years ago

@improved-software: I'm so glad to hear that :) Cheers!