angular-cli proxy path rewrite

I have an Angular 5 frontend running on localhost port 4200 and a spring backend on port 8080. Proxy support is setup with proxy.conf.json:

{
  "/api": {
    "target": "http://localhost:8080",
    "secure": false,
    "pathRewrite": {
      "^/api": ""
    }
  }
}

Some backend responses include HATEOAS links, e.g:

{
  "_embedded" : {
    "sample_endpoint" : [ {
      "title" : "Bunny & Butterfly",
      "description" : null,
      "contentType" : "video/mp4",
      "_links" : {
        "self" : {
          "href" : "http://127.0.0.1:8080/sample_endpoint/1"
        },
        "sample_endpoint_singular" : {
          "href" : "http://127.0.0.1:8080/sample_endpoint/1"
        },
        "play" : {
          "href" : "http://127.0.0.1:8080/other_endpoint/1"
        }
      }
    } ]
  },
  "_links" : {
    "self" : {
      "href" : "http://127.0.0.1:8080/sample_endpoint"
    },
    "profile" : {
      "href" : "http://127.0.0.1:8080/profile/sample_endpoint"
    }
  }
}

When the responses are returned to angular, the links are changed to e.g. http:/127.0.0.1:4200/sample_endpoint/1 and not to http:/127.0.0.1:4200/api/sample_endpoint/1 as i expected.

Am i missing some information about path rewrite?