Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to setup HTTP server running inside container? #195

Open
alienself opened this issue Jan 6, 2024 · 2 comments
Open

How to setup HTTP server running inside container? #195

alienself opened this issue Jan 6, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@alienself
Copy link

alienself commented Jan 6, 2024

I would like to know how it would be possible to expose an HTTP server running inside the container to the outside page so that an iframe running on the same browser tab could potentially make a request to the container.

For instance let's say that my container is running nodejs with express like so:

const express = require('express')
const app = express()
const port = 3000

app.get('/', (req, res) => {
  res.send('Hello World!')
})

app.listen(port, () => {
  console.log(`Example app listening on port ${port}`)
})

Is that something that is even possible without some sort of proxy server?
I would like to keep everything running locally.

@ktock
Copy link
Owner

ktock commented Jan 7, 2024

an iframe running on the same browser tab could potentially make a request to the container.

This is not implemented as of now. If needed, it would be good to fix the networking stack (c2w-net-proxy) to add such feature, using additional fds maybe.

@ktock ktock added the enhancement New feature or request label Jan 7, 2024
@Seanw265
Copy link

Seanw265 commented Feb 7, 2024

Seems like this enhancement would allow container2wasm to compete with the closed-source WebContainers project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants