# How to redirect path to external resource (AWS)

**URL:** <https://forum.serverless.com/t/how-to-redirect-path-to-external-resource-aws/10353>\
**Category:** Serverless Framework\
**Tags:** api-gateway\
**Created:** [January 23, 2020, 10:09pm UTC](https://forum.serverless.com/t/how-to-redirect-path-to-external-resource-aws/10353 "2020-01-23T22:09:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sbcgua](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/sbcgua/32/3918_2.png) [@sbcgua](https://forum.serverless.com/u/sbcgua)\
**Post date:** [January 23, 2020, 10:09pm UTC](https://forum.serverless.com/t/how-to-redirect-path-to-external-resource-aws/10353/1 "2020-01-23T22:09:21Z")

</div>

Hi there !  
Is it possible to setup a mock to redirect root path to another url ?

I mean a have a function, accessible at `/function1` path (resulting in `https://my.domain.com/function1`). And I want that `/` display some static documentation hosted elsewhere - so I need a 302 redirect to that URL (`https://my.domain.com/` -\> 302 -\> `https://my.docs.com/my-function-docs`). I don’t want this redirect to be handled by another lambda - no need - this is a static redirect.

P.S. just in case `my.domain.com` is a custom domain in Route 53, so with help of `serverless-domain-manager` the `https://my.domain.com/function1` works perfectly.  
P.P.S I’ve found [Set up response template for redirect](http://forum.serverless.com/t/set-up-response-template-for-redirect/340) but seems to be of different subject

---

<div class="post-metadata">

**Author:** ![sbcgua](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/sbcgua/32/3918_2.png) [@sbcgua](https://forum.serverless.com/u/sbcgua)\
**Post date:** [February 1, 2020, 8:40pm UTC](https://forum.serverless.com/t/how-to-redirect-path-to-external-resource-aws/10353/2 "2020-02-01T20:40:05Z")

</div>

Managed to achieve it with referring one function twice

```auto
    events:
      - http:
          path: main/root/to/the/function
          method: get
          cors: true
      - http:
          path: /
          method: get
          integration: mock
          request:
            template:
              application/json: '{"statusCode": 301}'
          response:
            template: redirect
            headers:
              Location: "'my-redirect-url-note-the-quotes-they-are-important'"
            statusCodes:
              301:
                pattern: ''

```
