HelloZeroNet / HelloZeroNet/ZeroNet

Feature Request: Add URL rewriting to sites

Offen
#1,548 0 Kommentare 6 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement
Vorherrschende Sprache
JavaScript
Sterne
18.8k
Forks
2.3k
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Allow each site to specify an URL rewriting scheme in `content.json`.
Proposed syntax:
```
"rewrite_rules": [
{ match: "files/.*", terminate: true },
{ match: "(.*)", replace: "index.html?url=\1", terminate: true },
]
```

The rewriting rules are:
* The URL which is checked to match against the regexp is the part after the site address, non including initial backslash.
* The matching rules are applied recursively until one with `terminate = true` is found. The first matched rule is the one which is applied at each step, each time starting from the first one.
* If the `replace` key is missing the returned string is not modified.

The final url should be then internally rendered and such page returned.
There should not be any html redirect.

If after 100 rewrites the url did not find a terminate condition, the site will log an error and the original request will be made.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Start by tracing how a site's content.json is loaded and how incoming URLs are internally rendered. Define the rewrite_rules behavior from the proposed syntax, including recursive matching, replacement, termination, and the 100-rewrite limit; done means rewritten pages render internally without an HTML redirect and non-terminating rewrites log an error before the original request is made.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Bereich
backend
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.