Support Topics Documentation Slack YouTube Blog

HTTP Redirect in Server Code

Hi,

Is it possible to return a response with HTTP Redirect headers (Location + 3xx http status code) from a server code service?

Thanks in advance

I’ve just found the solution. I noticed we can access the response object in the Invocation context such as request, and set headers to it. The status code can be set as well: this.request.statusCode = 301. It might be helpful to mention that over here: https://backendless.com/docs/bl-js/bl_invocation_context.html

Glad you found a solution, @RAFAEL_PEREZ! We plan to completely rewrite the Cloud Code docs, btw.

1 Like