0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

frpの設定はiniで書かないほうがいい

Posted at

frpとX-Forwarded-Protoヘッダー

frpとはローカルネットワーク内のサービスをNATやファイアウォールを越えて外部に公開するための、高速なリバースプロキシツールである。

私は、
nginx[443] (SSL終端) -> proxy_pass[http] -> frps[http] -> ...tunnel... -> frpc[http] -> local service[http]のようなhttp proxy構成を試みた。その時、frpはX-Forwarded-Protoヘッダーを除去する挙動があり、これは仕様である。そのため、frpc側で、

requestHeaders.set.x-forwarded-proto = "https"

のように、あとからhttpsだよというヘッダーを付与せねばならない。このことは x-forwarded-proto gets stripped away in http proxies fatedier/frp #4168 からわかる。

iniでは設定が効かない

しかし、私の環境ではこの設定を追記しても直らなかった(frps,frpc共にバージョンは0.62.1)。適当なヘッダーを付与してtcpdumpで確認したところ、一切ヘッダーが追加されないことが判明した。

frpcのログを見ていたところ、

WARNING: ini format is deprecated and the support will be removed in the future, please use yaml/json/toml format instead!

の一文が目に入ったため、iniで書いていた設定ファイルをtomlに書き直したところ、正常に動作した。

iniはやめよう

https://github.com/fatedier/frp?tab=readme-ov-file#configuration-files
Since v0.52.0, we support TOML, YAML, and JSON for configuration. Please note that INI is deprecated and will be removed in future releases. New features will only be available in TOML, YAML, or JSON. Users wanting these new features should switch their configuration format accordingly.

release noteを見る限り、このX-Forwarded-Protoを付与する機能はv0.58.0で追加されたものであるため、iniでは設定できず、toml, yaml, jsonじゃないと効かないパラメータである。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?