Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

195
Views
¿Cómo configurar www antes del nombre de dominio y después de http:// en Spring Boot y JavaScript?

Quiero saber acerca de la redirección de dominio. Es decir, quiero agregar www antes del nombre de dominio. Cómo lograr esto en Spring boot y JavaScript.

Mi URL es: https://example.com/dashboard

Quiero esto: https://www.example.com/dashboard

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Creo que debería configurarse en la interfaz como apache o proxy (nginx u otro).

about 4 years ago · Juan Pablo Isaza Report

0

Aconsejaría redirigir a la configuración de su servidor web, fuera de la aplicación Spring Boot. Pero en caso de que desee redirigir por algún motivo específico, puede agregar Filter a su configuración de Spring Boot:

 @Component public class RedirectionFilter extends GenericFilterBean { @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { final String host = request.getServerName(); if (!org.apache.commons.lang.StringUtils.startsWithIgnoreCase(host, "www.")) { HttpServletRequest httpRequest = (HttpServletRequest) request; HttpServletResponse httpResponse = (HttpServletResponse) response; //obtain the full requested URL StringBuffer requestURL = httpRequest.getRequestURL(); String queryString = httpRequest.getQueryString(); if (queryString != null) { requestURL.append("?").append(queryString); } //set up redirect String redirectURL = requestURL.toString(); redirectURL = redirectURL.replace(host, "www." + host); httpResponse.sendRedirect(redirectURL); } else { chain.doFilter(request, response); } } }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!