Skip to content

Add support for nextjs basePath #96

@aebruno

Description

@aebruno

We're interested in serving the slurm node dashboard using a sub-path behind nginx proxy. Nextjs appears to have support for this by setting the basePath config option, however this only seems to half work. The issue seems to be the components having the api paths hard coded, see here for example and do not currently support adding in this basePath.

Here's an example of what we're after:

Serve slurm node dashboard behind nginx proxy using a sub-path:

    location /slurm/mycluster {
        proxy_set_header    Host $host;
        proxy_set_header    X-Real-IP $remote_addr;
        proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header    X-Forwarded-Proto $scheme;
        proxy_http_version  1.1;
        proxy_set_header    Upgrade $http_upgrade;
        proxy_set_header    Connection "upgrade";
        proxy_pass http://localhost:3020;
    }

Add the following config to next.config.js:

const nextConfig = {
    basePath: "/slurm/mycluster",
    output: "standalone",

This will enable us to serve multiple clusters at different URI paths without having to use subdomains. If you're interested in supporting this we would be happy to submit a PR as we have this working in our dev environment. Thanks for the great project!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions