#[SOLVED] `Astro.url.hash` empty in SSR mode?

13 messages · Page 1 of 1 (latest)

honest sleet
#

The url hash is empty in Astro.url even though there's hashes in the url? Running in SSR mode so each request should be able to read it I'm pretty sure accordig to the docs: https://docs.astro.build/en/reference/api-reference/#astrorequest

Latest version of Astro and a repro here https://stackblitz.com/edit/github-qpu5xo?file=src%2Fpages%2Findex.astro

Run official live example code for Astro Basics, created by Withastro on StackBlitz

keen hazel
#

Astro.url is the cannonical URL used by Astro. It is provided in case you want to refer to it.
It has other normalizations besides stripping the hash.

The unmodified URL from the request is in Astro.request.url

#

The link you mentioned show Astro.request.url on it even

honest sleet
#

Ah yeah but sorry, Astro.request.url also doesn't contain in. Meant to say that, but even on the repro, changing it to Astro.request.url still doesn't have the hash on

main shadow
#

The hash is a browser only feature, it doesn't get sent to the server as part of the URL

honest sleet
#

[SOLVED] Astro.url.hash empty in SSR mode?

honest sleet
main shadow
#

Np, it's definitely confusing

keen hazel
#

TIL

#

I guess I never really tried that

#

You can parse a URL with a hash in Node, I never guessed that the browser would take it away