Redirect when HTTP_RESPONSE [HTTP::status] contains "200"

I need to set up a script that does redirection when there was status code 200 for the same page with dynamic context for example https://myURL.com/xtyfwdk

I set the following script but has error

Error : aFleX compile error : line 15: “command is invalid in current event context [ HTTP :: uri ]”
used script

When HTTP\_RESPONSE \{
if \{ [ HTTP :: Status] contains " 200 "\} \{
HTTP :: redirect " https://myurl.com[HTTP::uri]"
\}
\}

But when I set for a Static page works

When HTTP\_RESPONSE \{
if \{ [ HTTP :: Status] contains " 200 "\} \{

HTTP :: redirect " https://myurl.com/project/ "

\}
\}

Hi Leandro,

Aflex command HTTP::URI valid events are HTTP_REQUEST and HTTP_REQUEST_DATA, that’s why you are getting that error.

What about something like this?

when HTTP\_REQUEST \{
   set uri [HTTP::uri]
\}

when HTTP\_RESPONSE \{
   if \{ [HTTP::status] contains "200" \} \{

HTTP::redirect “https://myurl.com$uri

      \}
\}

Kind regards,
Daniel.