Return ‘X-WP-Total’ from headers in response

Ideally, you can access those headers with response.header, but not all headers are available publicly unless exposed manually. In your case, to access X-WP-Total by the client, you need to set the Access-Control-Expose-Headers header on your server:

Access-Control-Expose-Headers: X-WP-Total