h2oai / wave

Realtime Web Apps and Dashboards for Python and R
https://wave.h2o.ai
Apache License 2.0
3.9k stars 323 forks source link

Allow different origins for the websocket connection. RunPod Issue #2230

Closed pascal-pfeiffer closed 3 months ago

pascal-pfeiffer commented 5 months ago

Is your feature request related to a problem? Please describe

I am cross posting an issue from H2O LLM Studio which is using H2O Wave. Issue: https://github.com/h2oai/h2o-llmstudio/issues/557

When setting H2O_WAVE_ADDRESS and H2O_WAVE_LISTEN to 0.0.0.0 as required by RunPod, an error occurs when browsing to the site:

{"err":"websocket: request origin not allowed by Upgrader.CheckOrigin","t":"socket_upgrade"}

We actually saw a similar issue being reported earlier here but closed due to inactivity: https://github.com/h2oai/h2o-llmstudio/issues/39

Describe the solution you'd like

Add a config to allow access.

Describe alternatives you've considered

None

Additional context

From @mturoci on Discord about this issue:

I assume RunPod is routing the requests through some kind of proxy, hence the origins do not match. We can add a new waved config option to specify allowed origins. Please file a Github issue. See https://pkg.go.dev/github.com/gorilla/websocket#hdr-Origin_Considerations for more info.