←back to thread

.localhost Domains

(inclouds.space)
301 points todsacerdoti | 2 comments | | HN request time: 0.4s | source
Show context
sdwolfz ◴[] No.43651022[source]
Note: browsers also give you a Secure Context for .localhost domains.

https://developer.mozilla.org/en-US/docs/Web/Security/Secure...

So you don't need self signed certs for HTTPS on local if you want to, for example, have a backend API and a frontend SPA running at the same time talking to eachother on your machine (authentication for example requires a secure context if doing OAuth2).

replies(2): >>43651488 #>>43655983 #
bolognafairy ◴[] No.43651488[source]
Well shit. TIL. Time to go reduce the complexity of our dev environment.
replies(1): >>43652471 #
jrvieira ◴[] No.43652471[source]
you should never trust browsers default behavior

1. not all browsers are the same

2. there is no official standard

3. even if there was, standards are often ignored

4. what is true today can be false tomorrow

5. this is mitigation, not security

replies(1): >>43652901 #
wutwutwat ◴[] No.43652901[source]
1. not all browsers are the same

they are all aiming to implement the same html spec

2. there is no official standard

there literally is

> A context is considered secure when it meets certain minimum standards of authentication and confidentiality defined in the Secure Contexts specification

https://w3c.github.io/webappsec-secure-contexts/

3. even if there was, standards are often ignored

major browsers wouldn't be major browsers if this was the case

4. what is true today can be false tomorrow

standards take a long time to become standard and an even longer time to be phased out. this wouldn't sneak up on anyone

5. this is mitigation, not security

this is a spec that provides a feature called "secure context". this is a security feature. it's in the name. it's in the spec.

replies(2): >>43653404 #>>43670387 #
1. kbolino ◴[] No.43653404[source]
Notably, assuming conformance to this standard, a browser might still not treat localhost domains as trustworthy if it has reason to believe they can be resolved remotely. However, I'm not sure in what environments this is likely to be the case, especially with browsers implementing their own DNS over HTTPS.
replies(1): >>43656554 #
2. TingPing ◴[] No.43656554[source]
Recently browsers hardcode localhost to never resolve over dns.