I'm having trouble publishing a website in a subfolder (example.com/sitename) using Traefik.
The website is built with Next JS.
When I deploy, all script links in the built site ignore the folder (sitename). For example, a js script named generatedfile.js
is accessed by the link example.com/generatedfile.js
, when it should be
example.com/sitename/generatedfile.js
My Traefik arguments are:
-l traefik.frontend.rule="Host:example.com; PathPrefixStrip:/sitename" -l traefik.frontend.entryPoints="http, https" -l traefik.frontend.headers.SSLRedirect="true"
I tried adding a basePath to my next.config.js, but then I can only access the site at the link example.com/sitename/sitename
next.config.js:
module.exports = withFonts({
basePath: '/sitename'
});
I am using Docker to deploy on AWS.
I have been trying to solve this issue all day, but I am running out of ideas.
Apologies for any mistakes in my English, it is not my first language.