Exposing a port from a VS Code extension in Codespaces


I have a VS Code extension that launches a local server and opens it in a webview. The extension seems to be working fine in Codespaces, however I’m not sure how to expose the local server that it launches.

Currently, the webview is opened at http://localhost:3120, which obviously is incorrect when running on Codespaces. I tried appending :3120 to the Codespaces URL but, unsurprisingly, the port was not exposed.

I’m wondering if it’s possible at all to access a local server launched by an extension from Codespaces?

Thank you!