How to match an anchor


I’m trying to match a path with an anchor in it (see below). I’ve tried the following, but seems #some-anchor just disappears from the request uri:

path("") {
  extractRequest { implicit http_request =>

Expecting “http://host#some-anchor” but returns “http://host/”.

Any idea?


1 Like

Hi Martin, I think the anchor is client side only and is not actually sent to the server.

That’s really weird as I’m getting a redirect with an anchor from a reverse proxy. Thanks for the info.

I may be wrong, but running for example curl -v does not show the anchor anywhere in the request.

Didn’t think of this simple test, but yeah seems the anchor is removed from the request. Thanks for the help!

Reference is “The target URI excludes the reference’s fragment component, if any, since fragment identifiers are reserved for client-side processing”