Hi Pongsaphat,
This should work fine. Try to test the TWURL first before you introduce the http to https redirect. Below you can find a policy I have created for your specific need. Try adding the same in a seperate CPL layer and test the access.
<proxy>
url.domain=https://newmyapp.local action.App_portal(yes)
<cache>
action.ForceUncompressedResponse(yes)
define action ForceUncompressedResponse
delete(request.header.Accept-Encoding)
end action ForceUncompressedResponse
define url_rewrite App_rewrite
rewrite_url_prefix "https://newmyapp.local" "http://myapp.local:81"
rewrite_url_substring "https://newmyapp.local" "http://myapp.local:81"
rewrite_script_substring "https://newmyapp.local" "http://myapp.local:81"
end
define action App_portal
rewrite(url,"https://newmyapp.local/(.*)","http://myapp.local:81/$(1)")
rewrite(request.header.Referer, "https://newmyapp.local/(.*)", "http://myapp.local:81/$(1)")
rewrite(response.header.Location,"http://myapp.local:81/(.*)", "https://newmyapp.local/$(1)")
rewrite(response.header.Content-Location,"http://myapp.local:81/(.*)", "https://newmyapp.local/$(1)")
transform App_rewrite
end