peterldowns / localias Goto Github PK
View Code? Open in Web Editor NEWcustom local domain aliases for local dev servers
License: MIT License
custom local domain aliases for local dev servers
License: MIT License
Logs are emitted via manual printing, via caddy, etc. They look really ugly. Figure out a way to redirect and format the caddy logs, and unify with the log prints in the rest of the app. Allow json support and colorization. Clean up some of the noise.
I find that I often have to localias stop
and localias start
to trigger a renewal of my certificates. Is there an intended auto-refresh mechanism that isn't working, or is this just a feature request?
Makes everything easier if there's a template that prompts for:
hostname
)localias version
)localias list
/ localias debug config
/ localias debug config --print
)localias run
)Example - localias serve frontend.test -- pnpm dev
. Ideally it would be awesome if localias could grab the port on which the server is starting and assign the local domain but alternatively specifying the port also should work. After the command exits/is interrupted, the local domain can be removed
I can give this a try but the last time I touched Go was 2 years back so gonna need some help lol
In config file example and readme
insecure2.test: 9002
But it actually redirect to https
. For me is preferred to have HTTP default.
Tried with localias run
and localias daemon start
, the password input wouldn't work (clicking enter after entering the password would do nothing) on Warp. Entering the password from the default macOS terminal worked for me
Hi,
I've been using Hotel for a very long time and I'm glad that finally there is a great replacement. Would it be possible to add support for starting localias during boot (using plist on Mac and systemd unit on linux) or at least some instructions on how to do it?
Example for mac (I guess it should be stored in ~/Library/LaunchAgents/com.peterldowns.localias.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.peterldowns.localias</string>
<key>ProgramArguments</key>
<array>
<string>/opt/homebrew/bin/localias</string>
<string>start</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardOutPath</key>
<string>/Library/Logs/com.peterldowns.localias.out.log</string>
<key>StandardErrorPath</key>
<string>/Library/Logs/com.peterldowns.localias.err.log</string>
<key>KeepAlive</key>
<dict>
<key>SuccessfulExit</key>
<false/>
</dict>
<key>ThrottleInterval</key>
<integer>5</integer>
</dict>
</plist>
On Linux, installed via go install
error: loading new config: http app module: start: listening on :443: listen tcp :443: bind: permission denied
. I looked this up and used stackoverflow to fix it instead of the Readme since the quickstart didn't mention this issue. It would be nice if Localias could catch this error and point users to the correct fix / link to the README for further explanation.about:config
was default. Why was that? (Answer: because caddy will install its certs to firefox, and also java, if it can.On MacOS, installed via brew
/etc/hosts
. It should be clear that quitting the Localias process will leave the alias entries in /etc/hosts
.localias daemon stop
and localias daemon reload
should print nice error messages instead of complicated HTTP-related failures./etc/hosts
.sudo
but do not capture your password ourselves. Running localias with sudo localias
or authing to sudo
in your shell session, then running localias
, should prevent you from getting prompted.On MacOS, installed via brew
docs.local: 3000
as an address, but when visiting in browser, it (a) showed a cert warning, (b) sent the request to somewhere that wasn't localhost:3000. This was determined to be some kind of strange Bonjour problem. Advised
.local
alias if they're on a Mac.test
and .localhost
.dev
(all environments)localias run
should warn if the daemon is known to be running.The daemon starts, but fails to be stopped....
env:
darwin amd64
latest
localias daemon start
localias daemon stop
error: request to /stop failed: performing request: Post "http://%!/(MISSING)stop": http: invalid Host header
mDNS doesn't work over tailscale, but it would be really cool to be able to set up aliases accessible across tailscale
https://github.com/tailscale/caddy-tailscale
is potentially the way
Hello, recently this repository has gotten a lot of attention, which is great! Unfortunately I cannot tell if anyone is actually using the software or if they find it useful.
If you're here checking out Localias, please consider leaving a comment, filing an issue, sending me a tweet, or emailing me to let me know what you think!
I'm happy to make improvements, so any and all suggestions or complaints would be deeply appreciated.
Thank you for considering Localias,
Peter
🙇♂️
As mentioned here: https://github.com/peterldowns/localias#future-work
Happy to provide more context here but we found that unless we ran localias run
, we wouldn't get the root cert installed in the local store. Running it as a daemon did prompt for sudo but for some reason it wasn't the same as running it in the foreground. I wanted to report it in case other people ran into it, or if the documentation should be updated or if it's something that can actually be worked around.
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
Hi,
I was able to configure and successfully use localias in was wsl env (ubuntu 22.04). Everything works fine when i use my SLD (xxxx.test) but if I add my subdomain to my yaml file (admin.xxxx.test), it doesn't redirect properly
If you have any recommendations to get subdomains working, I'd greatly appreciate it
Drew
sorry! figured it out (puma-dev was running blocking 80/443) please delete)
Hi - curious if you have advice on how to get a native iOS app to accept the localias certificate in the simulator. I'm receiving the following error when I try to connect to https://server.local
from within my app:
Task <731C070D-A88C-4699-89D6-CB17360CD660>.<6> finished with error [-1202] Error Domain=NSURLErrorDomain Code=-1202 "The certificate for this server is invalid. You might be connecting to a server that is pretending to be “server.local” which could put your confidential information at risk." UserInfo={NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorDomainKey=3, NSErrorPeerCertificateChainKey=(
"<cert(0x10c6b3e00) s: server.local i: Localias Intermediate>",
"<cert(0x10c6b4400) s: Localias Intermediate i: Localias Root>"
), NSErrorClientCertificateStateKey=0, NSErrorFailingURLKey=https://server.local/api/graphql, NSErrorFailingURLStringKey=https://server.local/api/graphql, NSUnderlyingError=0x600000df9c50 {Error Domain=kCFErrorDomainCFNetwork Code=-1202 "(null)" UserInfo={_kCFStreamPropertySSLClientCertificateState=0, kCFStreamPropertySSLPeerTrust=<SecTrustRef: 0x600003470780>, _kCFNetworkCFStreamSSLErrorOriginalValue=-9807, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9807, kCFStreamPropertySSLPeerCertificates=(
"<cert(0x10c6b3e00) s: server.local i: Localias Intermediate>",
"<cert(0x10c6b4400) s: Localias Intermediate i: Localias Root>"
)}}, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <731C070D-A88C-4699-89D6-CB17360CD660>.<6>"
), _kCFStreamErrorCodeKey=-9807, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <731C070D-A88C-4699-89D6-CB17360CD660>.<6>, NSURLErrorFailingURLPeerTrustErrorKey=<SecTrustRef: 0x600003470780>, NSLocalizedDescription=The certificate for this server is invalid. You might be connecting to a server that is pretending to be “server.local” which could put your confidential information at risk.}
I went to https://server.local
in the Safari app inside the simulator and pressed the continue untrusted button, so I can now browse my local server just fine within Safari, but trusting this certificate this way does not seem to translate over into my app.
When running localias with localias run
, I'm getting an error that mDNS server cannot be started;
failed to start mDNS server:
could not determine host IP for .local domains: lookup Adrians-Macbook-Pro.local.local: no such host
When running $ hostname
(on MacOS Sonoma 14.2.1), I'm getting in terminal: Adrians-Macbook-Pro.local
.
I suspect the issue is from this line where it assumes that local
is not already passed in:
Line 46 in e3fade1
I'd post a PR to only append .local
if it doesn't already exist in the string but I'm not familiar with golang enough to contribute. Perhaps something like this could work:
userHost := baseHost
if strings.Contains(userHost, ".local") == false {
userHost = userHost + ".local"
}
baseIPs, err := net.LookupIP(userHost)
All 7 or 8 of the applications I've added to localias so far are functioning, but have this weird quirk where certain requests take an extra 4-5 seconds to actually "start doing anything". The application receiving the request makes no acknowledgement of receiving the request until the very end, at which point the response happens in milliseconds, so it does seem like something in localias/caddy is getting hung up (or mDNS or something).
The extra detail that makes this a little more confusing is that the problem disappears temporarily when serving an app through a web browser. The initial request to the application has this large up-front delay, and then after the first page loads, things are as snappy as a direct connection. After a few minutes of inactivity, a subsequent request has the same up-front delay, then back to being quick.
I use a desktop application that sends queries to one of the services I have set up, and that service behaves as I describe above in a web browser, but when sending requests to it from this separate application, all requests have an up-front delay, and there is no "warm cache" effect happening. I suppose this would mean that the browser is doing something that the application is not. The application in question is actually an electron app, and I'm using a Chrome-based browser, so they are more similar than not.
Let me know if this is a clear explanation, my head is still not on straight this morning.
Other notes:
2.0.1+commit.c358250
Suggest that the cli would clearer if it was like this:
localias alias ls
localias alias clear
localias alias set <alias> <port>
localias alias delete <alias>
All the others are nicely done.
you can easily import mkcert to do all this, and not need any brew stuff
basically whenever a new domain is added, you run mkcert $(DOMAIN)
and it will do all the trick cert trust stuff and gen the cert key and cert pem.
anyway here is the brew problem...
localias run
2023/07/21 11:11:34.192 INFO admin admin endpoint started {"address": "unix//Users/apple/Library/Application Support/localias/caddy.sock", "enforce_origin": false, "origins": [""]}
2023/07/21 11:11:34.202 INFO tls.cache.maintenance started background certificate maintenance {"cache": "0xc000118d20"}
2023/07/21 11:11:34.204 INFO tls cleaning storage unit {"description": "FileStorage:/Users/apple/Library/Application Support/localias/caddy"}
2023/07/21 11:11:34.204 INFO tls finished cleaning storage units
2023/07/21 11:11:34.273 WARN pki.ca.local installing root certificate (you might be prompted for password) {"path": "storage:pki/authorities/local/root.crt"}
2023/07/21 11:11:34.381 INFO warning: "certutil" is not available, install "certutil" with "brew install nss" and try again
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.