ForestAdmin / forest-express

🧱 Dependency of Express Lianas for Forest Admin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using a path in APPLICATION_URL fails

giregk opened this issue · comments

Expected behavior

I would like to user https://my-domain.com/path as my Forest Admin server URL. It should work fine.

Actual behavior

This setup partially works since I can finish the deployment, but then I can't access my data.
The problem comes from an "OPTIONS" request that is sent to my domain.com/forest/authentication/callback instead of my-domain.com/path/forest/authentication/callback.
Hence the request is not recognized by my reverse proxy and fails.

Failure Logs

Context

  • Package Version: 8.0.0

Solution

=> This bug comes from routes/authentication.js, in function getCallbackUrl, because of

var url = new URL("/forest/".concat(CALLBACK_AUTHENTICATION_ROUTE), applicationUrl);

(new URL removes all paths in applicationUrl)

To fix it, new URL should be given the absolute URL already concatenated.

var url = new URL(applicationUrl+"/forest/".concat(CALLBACK_AUTHENTICATION_ROUTE));

Hello @giregk,

We recently fixed this bug, as you can see in the current source code, this code has been changed to call this function that correctly joins the URL and path.

It has been fixed with #667, released with v8.0.4