[OPNWAF] Per virtual server option: redirect non-www to www

Abierto
#5,932 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
72/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
php
Área
backend, web-dev

Línea de trabajo

Start by locating the OPNWAF virtual server modal and the code that generates gateway_vhost.conf; the issue names the existing RewriteRule and the desired behavior. Trace how virtual server options reach the generated configuration, then check the relevant plugin tests or validation path. Done when the per-server checkbox produces the requested single redirect when enabled and preserves the current rule when disabled.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

support

Important notices
Before you add a new report, we ask you kindly to acknowledge the following:

Is your feature request related to a problem? Please describe.

If the "HTTP to HTTPS" option is enabled, the OPNWAF plugin redirects http://example.com to https://example.com, but not to the canonical https://www.example.com. The non-www to www redirect currently has to be done by the web server itself (e.g. via .htaccess), resulting in two consecutive redirects before reaching the canonical host.

Describe the solution you'd like

A per-virtual-server checkbox in the virtual server modal: "Redirect non-www to www". When enabled, requests to http://example.com should be redirected in a single redirect to https://www.example.com.

In the generated gateway_vhost.conf, the virtual host currently contains:

RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

With the option enabled it should instead contain:

RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Describe alternatives you've considered

Handling the non-www to www redirect from the web server itself via .htaccess, which works but requires a second redirect and moves canonicalization away from the edge.

Additional context

None.

Lenguaje dominante
PHP
Estrellas
1.2k
Forks
926
Merge medio
1 d 10 h
PR fusionados (30 d)
25

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de opnsense/plugins

Todos los issues de opnsense/plugins

Issues similares

Más issues de PHP

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.