godotengine / godotengine/godot

Cannot specify base url for GDExtension on web platform

Open
#98,272 2 comments 1 reaction 0 assignees View on GitHub
needs testing platform:web topic:gdextension
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

Tested in 4.3-stable

### System information

Web/WASM

### Issue description

I am trying to serve a Godot project on the web and am unable to load GDExtension wasm from urls not relative to the current page. The urls used by the server look something like:
```
https://servername.com/play/
https://servername.com/static/
```
with `play/` running through an application server to template the html file while `static/` files (js, wasm, etc) are served from something like S3.

This works fine until GDExtensions are involved because you can set `mainPack` and `executable` to the path you want and they will be fetched correctly. For extensions, it will fetch them as a relative path and there does not seem to be anything to change it. Using the urls above it would go to `https://servername.com/play/libname.whatever.wasm` instead of `https://servername.com/static/libname.whatever.wasm`. When I modify the application server to return the wasm on the url Godot uses, everything works.

Three questions:
* Am I missing something? Is there some way to set this?
* Is this a common problem that should be fixed for all godot users or am I on my own here?
* If it is a common problem then any pointers on what the 'correct' way to approach it would be appreciated.

Thanks!

### Steps to reproduce

N/A

### Minimal reproduction project (MRP)

N/A

Contributor guide

Open the contributing guide

Research direction

No source file, test, or entry point is named. Start by tracing how web exports resolve GDExtension WASM URLs and compare that with the existing mainPack and executable URL handling; done should mean an extension can be fetched from a separately configured static base URL.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, godot, wasm
Domain
game-dev, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.