vmware-labs / wasm-workers-server

🚀 Develop and run serverless applications on WebAssembly

Home Page:https://workers.wasmlabs.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Request URL only includes the path + query string

Angelmmiguel opened this issue · comments

Describe the bug

When wws builds the information to pass to the workers, it uses the WasmInput struct. This struct contains multiple fields like params, method and url. The url value should include the full URL of the current request, including the schema and authority section (host and port).

Currently, it's only including the path and the query_string. Some frameworks like HonoJS requires the entire URL to work, so they can properly match the route you want to serve. Checking the Request object from the browser API, the url property includes all the information.

Reproduction steps

  1. Create a JavaScript worker
  2. Print the URL with console.log(request.url)
  3. Check it doesn't include the schema and the authority section

Expected behavior

The url value contains the full URL. If for any reason wws cannot retrieve this information, it defaults to the path and query string. There's an open discussion about this topic on the actix-web repository: actix/actix-web#2895.

Additional context

No response