htmx
htmx copied to clipboard
Links leading same hostname but another port incorrectly considered local
If a website hosted on (e.g.) http://localhost:3001 has an anchor element with the href being (e.g.) http://localhost:3002, the anchor will be considered local which enables boosting (if used). Since websites hosted on different ports (at least in the localhost case) usually are different websides (and them being considered different origins, possibly causing CORS troubles) i believe this i a bug.
This i because isLocalLink compares the hostnames of location and the anchor element. I propose changing this to comparing the origins instead.
Implementation is here: https://github.com/bigskysoftware/htmx/blob/f919c0705182c904a440e3ff4a9687f4d5166c55/src/htmx.js#L1407