web icon indicating copy to clipboard operation
web copied to clipboard

[dev-server] setting basePath substrings prefix from resource url

Open viksok opened this issue 4 years ago • 1 comments

Setting base path in web-dev-server.config.js trims not just /path/ but also /path/path-to-resource. This makes links invalid /-to-result.

For now I only found a solution to create a middleware to restore sub-stringed prefix.

Also please consider clearer way of removing base path from urls. Maybe regex instead of a string.

Steps to reproduce:

  1. set <base href="/gib/" /> in index.html (js or jsx should work too)
  2. in web-dev-server.config.js set basePath="/gib" ("/gib/" seems to be invalid)
  3. try to make request from frontend to <app.domain>/gib/gib-test.

Expected result: request url in console wil look like: <app.domain>/gib-test.

Actual (wrong) result: <app.domain>/-test

viksok avatar Oct 29 '21 11:10 viksok

It's even worse than that... The NAME_WEB_SOCKET_IMPORT injected js is not a relative path, so it is impossible to make a dev server run behind a reverse proxy.

lucaslugao avatar Aug 22 '22 01:08 lucaslugao