# Server response redirected to other port.

**URL:** <https://community.a10networks.com/t/server-response-redirected-to-other-port/376>\
**Category:** aFleX\
**Tags:** redirect\
**Created:** [February 16, 2016, 10:41pm UTC](https://community.a10networks.com/t/server-response-redirected-to-other-port/376 "2016-02-16T22:41:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![evea](https://avatars.discourse-cdn.com/v4/letter/e/b3f665/32.png) [@evea](https://community.a10networks.com/u/evea)\
**Post date:** [February 16, 2016, 10:41pm UTC](https://community.a10networks.com/t/server-response-redirected-to-other-port/376/1 "2016-02-16T22:41:57Z")

</div>

Our team is looking for an aflex code that can rewrite the server response.

We want to achieve in this aflex is to redirect first the traffic response from the server to 192.168.10.1:3013 for authentication login then after user successfully login redirect again to the other port 192.168.10.1:2011 which is the main dashboard of the user.  
Note all of this application is reside only on one server.

We are trying this script but it is not working. Can someone tell me working script.

```auto
when HTTP\_RESPONSE \{
set VIPtest 192.168.8.103

```

# For all the redirects from the servers  
&nbsp;&nbsp;&nbsp;&nbsp;if { [HTTP::is\_redirect] } {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Check if the location header contains “:8080”  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if {(HTTP::host contains “:8080”)} {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Remove “:8080” from the Location header  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;HTTP::redirect “http://:8009$VIPtest”

```auto
    \}
  \}
\}

```
