peterldowns / localias

custom local domain aliases for local dev servers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fails to server over https://test

gedw99 opened this issue · comments

commented

daemon is running

via CLI i setup alias for "test: 8080"

localias debug config --print
# localias config file syntax
#
#       alias: port
#
# for example,
#
#   https://secure.test: 9000
#   http://insecure.test: 9001
#   insecure2.test: 9002
#   bareTLD: 9003
#
test: 8080

my little test server:
go run .

package main

import (
	"fmt"
	"net/http"
)

func main() {
	fmt.Print("starting on port: 8080")

	http.HandleFunc("/", HelloServer)
	http.ListenAndServe(":8080", nil)
}

func HelloServer(w http.ResponseWriter, r *http.Request) {
	fmt.Fprintf(w, "Hello, %s!", r.URL.Path[1:])
}

```

test it:

```sh
url  http://localhost:8080/
Hello, !%                                          

test is via localias caddy proxy:

curl  https://test:443
curl: (6) Could not resolve host: test
curl  https://test 
curl: (6) Could not resolve host: test

I unfortunately cannot reproduce this problem using localias version 1.0.1 on MacOS 12.5.1 (arm). Here's a screenshot where I am running localias and your golang web server and successfully connecting to it

image

My first hypothesis is that you started the daemon, added the test: 8080 alias, but didn't reload or restart the daemon so it does not know about the alias. If this is the case, you should be able to fix the issue in one of these ways:

  • Stop the daemon and run localias in the foreground, localias daemon stop && localias runcommand.
  • Reload the daemon localias daemon reload
  • Restart the daemon entirely localias daemon stop && localias daemon start

Then, running your curl https://test:443 or curl https://test commands.

If that doesn't work, can you please tell me:

  • What operating system and architecture this is running on
  • How you installed localias and what version you're using (localias version)
  • The result of localias hostctl list (maybe Localias was unable to edit your /etc/hosts file to add the rule for test?)

Closing since I cannot reproduce this issue. I will re-open this if I can get enough information to reproduce the problem or others report the same thing.