HelloZeroNet / HelloZeroNet/ZeroNet

Feature Request: Add URL rewriting to sites

オープン
#1,548 コメント 0 件 リアクション 6 件 担当者 0 名 GitHub で見る
enhancement
主要言語
JavaScript
スター
18.8k
フォーク
2.3k
PR マージ指標
30日以内にマージされた PR はありません

説明

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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

サイトの content.json がどのように読み込まれ、受信した URL が内部でどのようにレンダリングされるかを追跡することから始めます。提案された構文に基づいて、再帰的なマッチング、置換、終了、100 回の rewrite 制限を含む rewrite_rules の動作を定義します。書き換えられたページが HTML リダイレクトなしで内部的にレンダリングされ、終了しない rewrite が元のリクエストを実行する前にエラーをログに記録すれば完了です。

索引モデルが issue の本文から書いたものです。

評価

領域
backend
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。