HelloZeroNet / HelloZeroNet/ZeroNet

Access-Control-Allow-Origin not added with transparent proxy requests

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

説明

## Description

So I've been testing the new [transparent proxy](https://github.com/HelloZeroNet/ZeroNet/pull/1445) feature, and it's quite cool to just be able to type `zerolstn.bit` into the address bar and have it resolve appropriately. The only issue is that the font files don't seem to have the 'Access-Control-Allow-Origin' header included in the response. However, when using http://127.0.0.1/zerolstn.bit the header is included and the font files do load.

## How to Reproduce

1. Run ZeroNet on port 80 with a transparent proxy:

```
sudo python ./zeronet.py --ui_port 80 --ui_trans_proxy
```

2. Change your `/etc/hosts` file to have localhost assigned to `zerolstn.bit`:

```
127.0.0.1 zerolstn.bit
```

3. Visit `zerolstn.bit` in your browser and see things load! But not the font files...

## Cause

This little line here seems to be the issue:

https://github.com/HelloZeroNet/ZeroNet/blob/7bff5f562c42a4a5f73e104c0f767c1413064aa6/src/Ui/UiRequest.py#L222-L223

Along with the code for `isSameOrigin`:

https://github.com/HelloZeroNet/ZeroNet/blob/7bff5f562c42a4a5f73e104c0f767c1413064aa6/src/Ui/UiRequest.py#L431-L436

`self.isSameOrigin` is returning false for the `zerolstn.bit` address. I believe it is due to there being no `127.0.0.1:43110` in front of the site URL, so we may need to change some regex here.

Tagging @JeremyRand for his interest.

Thanks!

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

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

調査の方向性

Start in src/Ui/UiRequest.py at the linked lines around the Access-Control-Allow-Origin response handling and isSameOrigin. Reproduce the transparent proxy setup with --ui_port 80 and --ui_trans_proxy, using zerolstn.bit in /etc/hosts, then compare the header behavior with http://127.0.0.1/zerolstn.bit. Done means font responses through the transparent proxy include the expected header.

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

評価

技術スタック
python
領域
networking
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
35/100

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

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