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

Aperta
#5,932 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
72/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
php
Ambito
backend, web-dev

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
PHP
Stelle
1.2k
Fork
926
Merge medio
1g 10h
PR unite (30g)
25

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di opnsense/plugins

Tutte le issue di opnsense/plugins

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.