HelloZeroNet / HelloZeroNet/ZeroNet

Feature Request: Add URL rewriting to sites

Aperta
#1,548 0 commenti 6 reazioni 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
JavaScript
Stelle
18.8k
Fork
2.3k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.