Avoid the 307 redirect

I’ve created this simple notebook which starts an express server and then returns the process.env.RUNKIT_ENDPOINT_URL value in order to show the response.

That’s the same that happens in the default express example running at https://npm.runkit.com/express with the difference that in my notebook requesting process.env.RUNKIT_ENDPOINT_URL results in a 307 status code whereas in the express sample case it returns 200.

I’m wondering if there’s a way to avoid the redirect and why it’s not happening in the express sample.

Hi simoneb,

So I believe what’s going on is that in the notebook example, since you are logged in we provide the “nice” URL, which then redirects to the actual endpoint URL. In the express example, since its an embed there is no user and it thus solely provides the actual endpoint URL. We could provide this as a separate environment variable if that would be helpful to you.

Thanks,

Francisco

That would explain it. Well it’s not a very big deal but either via an additional environment variable or a different mechanism it should be nice to have the final url without any redirects readily available

@tolmasky To be able to actually use these as backend endpoints, the “nice” url are necessary. This is because I can’t update my client code with a new url every time I make a change in the backend. A nice URL like /branches/master or /1.0.2 is what makes this really useable from client side.