Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error loading resources when parse-dashboard in mounted on a subpath #1747

Open
3 tasks done
dantehemerson opened this issue Jul 21, 2021 · 0 comments · May be fixed by #2433
Open
3 tasks done

Error loading resources when parse-dashboard in mounted on a subpath #1747

dantehemerson opened this issue Jul 21, 2021 · 0 comments · May be fixed by #2433
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@dantehemerson
Copy link

dantehemerson commented Jul 21, 2021

Make sure these boxes are checked before submitting your issue -- thanks for reporting issues back to Parse Dashboard!

  • You're running version >=1.0.23 of Parse Dashboard.

  • You're running version >=2.3.2 of Parse Server.

  • You've searched through existing issues. Chances are that your issue has been reported or resolved before.

Environment Setup

Issue

I'm using the parse-dashboard as express-middleware, and I'm mounting on /dashboard route:

dashboardApp.use('/dashboard', dashboard);

My API is being mounted on a subpath in my organization, e.g. https://my.org/sub/path, which means the Dashboard would be accessible at https://my.org/sub/path/dashboard.

But in the app, the path taken by parse-dashboard is /dashboard, which leads to incorrect resources paths in the HTML.

I have created an example here simulating the problem.

screenshot (1)

Console logs:

image

As you can see, it loads the resources from the base path.

The expected behavior should be to load the resources with /sub/path/dashboard prefix.

Steps to reproduce

Mount express app in a subpath.

const dashboardApp = express();
// ParseDashboard takes '/dashboard' as mountpath
dashboardApp.use('/dashboard', dashboard);

// Mount dashboard at /sub/path/dashboard
app.use('/sub/path/', dashboardApp);


const httpServer = require('http').createServer(app);
httpServer.listen(port);

You can see the complete example simulating the problem here.

My simple solution

In this part of the code:

const mountPath = getMount(app.mountpath);

I have added an option in the middleware to support a prefix param.

const mountPath = (options.prefix || '' ) + getMount(app.mountpath);

and it can be used as:

dashboardApp.use('/dashboard',  new ParseDashboard(..., { prefix: `/sub/path`  }));

I want to know what are your regardings about it.

If you think this feature can be added, I could take it.

Logs/Trace

Note: If you get a browser JS error please run npm run dev. This will provide source maps and a much more useful stack trace.

@mtrezza mtrezza added the type:bug Impaired feature or lacking behavior that is likely assumed label Sep 30, 2021
@Hellslicer Hellslicer linked a pull request May 14, 2023 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants