QwikDev / qwik

Instant-loading web apps, without effort
https://qwik.dev
MIT License
20.64k stars 1.28k forks source link

[🐞] Redirection to external conntent from backend should be clarified in docs or has issue... #6688

Open Kampouse opened 1 month ago

Kampouse commented 1 month ago

Which component is affected?

Qwik City (routing)

Describe the bug

I was reproducing the repository onto my local repository https://github.com/vfshera/qwik-lucia-auth the only issue that i encounter is
image The authJs integration does something smiliar for the auth flow. The authjs code: https://github.com/QwikDev/qwik/blob/563ddc512a9dec38194f10914ad5988f523bd71d/packages/qwik-auth/src/index.ts#L61 the lucia code that could work but error: https://github.com/vfshera/qwik-lucia-auth/blob/17d83445bad5cebb30fbb50ae9838939e0114e85/src/routes/plugin%40lucia.ts#L87 My question is it normal that it 404? if it's normal : error/documentation(how you can redirect to external resource) if its not normal: ????

Reproduction

https://github.com/vfshera/qwik-lucia-auth

Steps to reproduce

run the repository open browser to login login

System Info

System:
    OS: macOS 14.5
    CPU: (8) arm64 Apple M1
    Memory: 125.20 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.0.0 - /opt/homebrew/bin/node
    npm: 10.5.1 - /opt/homebrew/bin/npm
    pnpm: 9.2.0 - /opt/homebrew/bin/pnpm
    bun: 1.1.7 - ~/.bun/bin/bun
  Browsers:
    Brave Browser: 112.1.50.121
    Chrome: 126.0.6478.127
    Edge: 117.0.2045.40
    Safari: 17.5
  npmPackages:
    @builder.io/qwik: ^1.5.2 => 1.5.2
    @builder.io/qwik-auth: 0.1.1 => 0.1.1
    @builder.io/qwik-city: ^1.5.2 => 1.5.2
    typescript: 5.3.3 => 5.3.3
    undici: * => 6.14.1
    vite: ^5.1.6 => 5.2.10

Additional Information

No response

blecorre-mnp commented 1 month ago

Can confirm that using throw redirect('https://anotherdomain/...') is kinda weird on Qwik. It works fine on in-app routes (relative paths), but once you need to navigate to an URL with a different domain - see repro here https://stackblitz.com/edit/qwik-starter-zjy3c6 - it doesn't work and returns a 404.

We actually have the same issue for auth redirect in our work codebase, we hack things by redirecting to a onGet route, which in turn redirects to our other platforms on different subdomains.

Update - If this is expected behaviour, the documentation here is a bit misleading. Would be nice to have a workaround if so!