> For the complete documentation index, see [llms.txt](https://mgcrea.gitbook.io/redux-rest-resource/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mgcrea.gitbook.io/redux-rest-resource/advanced/headersoverride.md).

# Headers Override

* You can configure `headers` globally:

```javascript
export const {types, actions, reducers} = createResource({
  name: 'user',
  url: 'https://foo.com/users/:id',
  headers: {
    'X-Custom-Header': 'foobar'
  }
});
```

* You may want to globally update default `headers` at run time (eg. you received a new JWT):

```javascript
import {defaultHeaders} from 'redux-rest-resource';
const jwt = 'xvDjirE9MCIi800xMxi4EKeTm8e9FUBR';
Object.assign(defaultHeaders, {Authorization: `Bearer ${jwt}`});
```

* You can also configure `headers` for a specific action:

```javascript
export const {types, actions, reducers} = createResource({
  name: 'user',
  url: 'https://foo.com/users/:id',
  actions: {
    update: {
      headers: {
        'X-Custom-Header': 'foobar'
      }
    }
  }
});
```

* Or as an one-time override at action call-time:

```javascript
actions.updateUser({firstName: 'Olivier'}, {headers: {Authorization: `Bearer ${jwt}`}});
```
