Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

125
Vistas
Html base href rewriting get first 404 after 200

I have a blazor app under the sub directory of an site on IIS. To fix blazor wasm base path problem, applied javascript code below in the head tag (suggested on elmah.io: https://blog.elmah.io/how-to-fix-blazor-wasm-base-path-problems/)

<!-- omitted for clarity -->
<head>
  <base />
  <script>
      var path = window.location.pathname.split('/');
      var base = document.getElementsByTagName('base')[0];
      if (window.location.host.includes('localhost')) {
          base.setAttribute('href', '/MyApp/');
      } else if (path.length > 2) {
          let href = '/' + path[1] + '/MyApp/';
          base.setAttribute('href', href);
      } else if (path[path.length - 1].length != 0) {
          let fullpath = window.location.origin + window.location.pathname + '/' + window.location.search;
          window.location.replace(fullpath);
      }
  </script>
</head>

It works pretty well and solve the blazor base path problem. But, when you enter the app url without ending with '/', the developer console fills up with 404 (not found) errors and then all of them turns out 200 (ok) ok for all css/js files. Why is it do that and can i fix it?

console In the network view all of resources get first 404 after 200

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda