Skip to content

[bug] Absolute path breaks when capjs is not at root #211

@DorianCoding

Description

@DorianCoding

bug description:
If capjs is hosted like at example.com/capjs/, links does not work for dashboard (login & settings).

affects:

  • standalone
  • [] widget (ui)
  • [] widget (wasm solver)
  • js server
  • [] js solver

to reproduce:
Proxy_pass capjs from /capjs for instance on a server.

expected behavior:
Links are relative and work.
Example of lines that breaks:

api("GET", "/settings/headers").then((res) => {
    headerSettings = res?.error ? null : res;
    hasGeoSource = !!(
      headerSettings?.countryHeader ||
      (ipdbStatus?.mode && ipdbStatus.mode !== "")
    );
  });

  api("GET", "/settings/ratelimit").then((res) => {
    ratelimitSettings = res?.error ? null : res;
  });

  api("GET", "/settings/cors").then((res) => {
    corsSettings = res?.error ? null : res;
  });

  api("GET", "/settings/filtering").then((res) => {
    filteringSettings = res?.error ? null : res;
  });

  api("GET", "/settings/ipdb").then((res) => {
    ipdbStatus = res;
    hasGeoSource = !!(
      headerSettings?.countryHeader ||
      (ipdbStatus?.mode && ipdbStatus.mode !== "")
    );
  });

  loadKeys();
}

async function loadKeys() {
  keys = await api("GET", "/keys");

screenshots:
Observed:
Image
Expected:
Image

versions and environment:
e.g. browser, os, device, etc

additional context:
Replace all /xxxx links by xxxx links should work if there is no sublinks like:

async function loadKeys() {
  keys = await api("GET", "keys");

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions