# How to add a header to an existing Request object

**URL:** https://discourse.slimframework.com/t/how-to-add-a-header-to-an-existing-request-object/2224
**Category:** Questions
**Created:** [February 7, 2018, 9:51am UTC](https://discourse.slimframework.com/t/how-to-add-a-header-to-an-existing-request-object/2224 "2018-02-07T09:51:54Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![antx](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@antx](https://discourse.slimframework.com/u/antx)
#### Post date: [February 7, 2018, 9:51am UTC](https://discourse.slimframework.com/t/how-to-add-a-header-to-an-existing-request-object/2224/1 "2018-02-07T09:51:54Z")

</div>

I get a request which I want to forward via guzzle, but with an aditional header.

**client** —[myRequest]—\> **Service** —[myRequest with added Header]—\> **2ndService**

I use

`$myRequest->withUri($uri_of_2nd_service)`

to change the uri of the request and that works great.

But how can i slip in an additional header?  
$r = $r-\>withHeader(‘myHeader’, ‘bla’) works only for response objects, right?

---

<div class="post-metadata">

### Author: ![odan](https://avatars.discourse-cdn.com/v4/letter/o/9de053/32.png) [@odan](https://discourse.slimframework.com/u/odan)
#### Post date: [February 7, 2018, 2:18pm UTC](https://discourse.slimframework.com/t/how-to-add-a-header-to-an-existing-request-object/2224/2 "2018-02-07T14:18:18Z")

</div>

According to the PSR-7 message interface there is a ServerRequestInterface [withHeader()](https://github.com/php-fig/http-message/blob/master/src/MessageInterface.php#L132) method.

---

<div class="post-metadata">

### Author: ![antx](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@antx](https://discourse.slimframework.com/u/antx)
#### Post date: [February 8, 2018, 11:24am UTC](https://discourse.slimframework.com/t/how-to-add-a-header-to-an-existing-request-object/2224/3 "2018-02-08T11:24:25Z")

</div>

Okay, I tried this and it works. Thanks a lot!
