Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

115
Visualizações
Publish a site in a subfolder with traefik and Next JS

I'm trying publish a website in a subfolder (exemple.com/sitename) usign Traefik.

The site is build with Next JS.

What is happening when I run deploy is that all script links in the builded site disregard the folder (sitename). For example, js script named generatedfile.js is being accessed by the link example.com/generatedfile.js, the corret way would be example.com/sitename/generatedfile.js

My traefik args:

-l traefik.frontend.rule="Host:example.com; PathPrefixStrip:/sitename" -l traefik.frontend.entryPoints="http, https" -l traefik.frontend.headers.SSLRedirect="true" 

I had tried add basePath to my next.config.js, but when I do this, I only access de site in the link exemple.com/sitename/sitename

next.config.js:

module.exports = withFonts({
  basePath: '/sitename'
});

I'm using docker to deploy in AWS.

I've been trying to solve this all day, I don't even know what else to try to solve it.

Sorry for my english, it's not my first language.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

PathPrefixStrip means match the path and strip the matched string before forwarding the request to your application. Use PathPrefix instead.

Looks like you're using v1.x of Traefik. Here's the documentation explaining the difference better: https://doc.traefik.io/traefik/v1.7/basics/

It's worth mentioning that if you have multiple routing rules, Traefik sorts them by their string length in a descending order and goes through them to match the incoming request. In other words, /api is matched before /.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda