Redirect to external urls from a service

I want to redirect to an external URL from enonic service. I can redirect to my app page using the below code. Is there any way to redirect to external URL from return value

exports.get = function (req) {
//other codes
let res = {redirect: portal.url({path:./page’})};
return res;
}

Hi @cherysan19, it is supposed to work, have you already tried it?

I tried. it gives error with this URL http://app.com:8080/_/error/400?message=URI+out+of+scope

Is there an error in server log or in the browser’s console? Can we see a stack trace?

@cherysan19 Can you share your exact code when you are getting that error?