Akka HTTP Allow illegal encoding

I am having an issue where I am not able to receive request that have illegal encoding, namely %%. An example URL would be If I make a request to this URL I receive an error: Illegal request-target: Invalid input '%', expected HEXDIG (line 1, column 13). I have tried creating an exception handler, rejection handler, and setting uri-parsing-mode = relaxed. Ideally I could somehow get the raw data in these cases and process the request anyway, as despite having bad encoding, they are still a valid request for my use case, but being able to handle the exception would probably be enough. Being unable to process these requests would result in unacceptable data loss in my case. Here is an my current test snippet:

import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.model.HttpMethods._
import akka.http.scaladsl.server.Directives._
import scala.io.StdIn
import akka.http.scaladsl.server._
import akka.http.scaladsl.model._

object Main extends App {

  implicit def myRejectionHandler =
      .handle {
        case _: IllegalUriException =>
          println("Illegal URI rejection")
      .handleAll[MethodRejection] { methodRejections =>
        println("Handle all")

  implicit def myExceptionHandler: ExceptionHandler =
    ExceptionHandler {
        case _: IllegalUriException =>
          println ("Illegal URI Exception")

  implicit val system = ActorSystem()
  implicit val executionContext = system.dispatcher

  val route = {
    handleExceptions(myExceptionHandler) {
      get {
        path("path") {

  val bindingFuture = Http().newServerAt("", 80).bind(route)
  println(s"Server online at http://localhost:80/\nPress RETURN to stop...")
    .onComplete(_ => system.terminate())