Skip to content

Commit 6856eb4

Browse files
authored
Merge pull request #5 from jamesfancy/master
translate rewrite parts and faqs
2 parents 5d405d4 + 17eecbe commit 6856eb4

File tree

5 files changed

+196
-188
lines changed

5 files changed

+196
-188
lines changed

source/faqs/index.md

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
title: FAQs
22
---
33

4-
### hiproxy的核心目的/功能是什么?
4+
### What's the core feature(or purpose) of hiproxy?
55

6-
hiproxy的核心功能是代理请求,主要是为了解决前端开发工程师在本地开发过程中遇到的:
6+
The core feature of hiproxy is forwarding request. Hiproxy purposes to solve some problems which front-end developer can meet while working:
77

8-
- `hosts`修改后由于DNS缓存不能立刻生效
9-
- 需要使用Nginx来做反向代理
10-
- 自签名HTTPS证书不受信任
11-
- 每个人都在本地维护环境配置文件(hosts/Nginx配置)
8+
- `hosts` cannot work immediately since there are caches after it's updated.
9+
- Nginx is used for reverse proxy.
10+
- Self signed HTTPS certificate are not trusted.
11+
- Everyone maintans the environment profile (hosts/nginx configuration).
1212
- ...
1313

1414
<br/>
1515

16-
### hiproxy跟Charles/Fiddler有什么区别?
16+
### What's the difference between hiproxy and Charles/Fiddler?
1717

18-
hiproxy跟Charles/Fiddler都有抓包、请求代理的功能,很多核心的功能基本类似。只不过hiproxy是一个命令行的工具,使用配置文件来配置。
18+
They all have the ability to capture packages, proxy request and many core function. But hiproxy is a CLI tool which works with configuration files.
1919

20-
此外,hiproxy现在没有查看网络请求的具体内容的界面,将来会通过插件开发,敬请期待。
20+
However, hiproxy has no interface to see the specific content of request. That will be introduced as a plugin in the future.
2121

2222
<br/>
2323

24-
### hiproxy的hosts跟系统hosts有什么关系
24+
### What's the relationship between hosts for hiproxy and for OS
2525

26-
hiproxy的hosts跟系统hosts文件本身没有任何关系。
26+
They are no relationship actually.
2727

28-
hiproxy的hosts文件一般存放在项目中,或者其他目录(根据用户情况自己决定放到哪里)。hiproxy代理服务启动的时候,会查找并解析这些hosts文件,**不会去查找解析系统hosts**
28+
the hosts file for hiproxy is normally placed in project directory, or other (user specified) directory. Hiproxy would looking for, load and parse the hosts file in project directories, **but not do with OS one**.
2929

3030
<br/>
3131

32-
### hiproxy的rewrite配置文件完全兼容Nginx配置吗?
32+
### Is the rewrite configuration file for hiproxy fully compatible with Nginx configuration?
3333

34-
不兼容,hiproxy的rewrite规则配置文件跟Nginx的配置文件本身没有任何关系。
34+
No. They are no relationship actually.
3535

36-
从语法上看,hiproxy的rewrite配置文件借鉴了Nginx配置的语法。核心的语法跟Nginx的语法一致,但是也有些语法是hiproxy特有的,并不完全跟Nginx语法一致,比如:
36+
The rewrite configuration for rewrite has similar syntax of Nginx configuration. The core syntax is consistent with the syntax of Nginx, but there are also some syntax are specific to hiproxy. They are not exactly consistent with Nginx syntax. For example:
3737

3838
```bash
3939
# base rule
@@ -45,36 +45,35 @@ hiproxy.org => {
4545
}
4646
```
4747

48-
此外,也有部分指令采用Nginx的指令名称且功能基本类似,比如`proxy_pass``set``ssl_certificate``ssl_certificate_key`等。但是也**不保证所有的功能细节跟Nginx的指令保持一致**。详细的指令功能说明请参考[指令](../rewrite/directive.html)
48+
In addition, some directives come from Nginx which do simular things, such as `proxy_pass`, `set`, `ssl_certificate` and `ssl_certificate_key`, etc. In any case they **cannot promise that all details are same as Nginx directives.**Please see [Directive](../rewrite/directive.html) for more information.
4949

5050
<br/>
5151

52-
### hiproxy多个项目中的不同配置文件使用相同的域名吗?
52+
### Are different configuration file used in multiple hiproxy projects using the same domain name?
5353

54-
支持。
54+
It's supported.
5555

56-
可以在不同的项目的不同配置文件中,给相同的域名配置代理规则。hiproxy会自动合并相同域名的规则,如果路由配置有冲突,后加载的配置文件的规则会覆盖前面的规则。
56+
You can set rules for the same domain name in configuration files of different projects. Hiproxy can merge all rules about the same domains. If there is conflict, later loaded rules would rewrite earlier rules.
5757

5858
<br/>
5959

60-
### hiproxy怎么处理多个配置文件中的规则冲突?
61-
62-
详细的配置规则处理文档正在编写。
60+
### How does hiproxy handle the conflict between multiple configuraton files?
6361

62+
Some soon.
6463

6564
<br/>
6665

67-
### hiproxy根证书怎么获取/导入
66+
### How to get/import root certificate of hiproxy
6867

69-
可以查看文档[获取/导入SSL证书](../configuration/ssl_certificate.html)
68+
See [get/import SSL certificate](../configuration/ssl_certificate.html)
7069

7170
<br/>
7271

73-
### hiproxy中如何使用自己的SSL证书
72+
### How hiproxy to use it own SSL certificate
7473

75-
默认情况下,在代理https请求的时候,hiproxy会**自动生成证书**,并使用hiproxy自定义的CA证书签名。用户只需要导入hiproxy的根证书。
74+
By default, when the https request is forwading, hiproxy will **generate the certifiate automatically** and use customized CA certificate signature. The users should import root certificate of hiproxy.
7675

77-
如果用户需要使用自定义的证书,可以·使用hiproxy提供的指令来配置:
76+
If you use customized certificate, ou can use some hiproxy directive for configurating:
7877

7978
```
8079
ssl_certificate ./hiproxy.org.crt;

source/rewrite/built_in_variable.md

Lines changed: 42 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,87 @@
1-
title: Rewrite built in variables
1+
title: Rewrite Built-in Variables
22
---
33

4-
> 如果你愿意帮助hiproxy编写文档,请联系zdying@live.com, 谢谢!
5-
>
64
> If you are willing to help hiproxy to write documentation, please contact zdying@live.com, thank you!
75
8-
hiproxy的rewrite规则配置文件中,我们可以自己定义全局变量(在全局作用域中使用`set $var value`),也可以在其他作用域中定义变量;
6+
You can define your own global variables (use `set $var value` in global scope) in rewrite rules configuration file of hiproxy, as well as you can define variables in other scopes.
97

10-
hiproxy内置了一些变量,这些内置变量可以在相应的作用域中直接使用,不需要去定义并赋值,而且这些内置变量也不能被用户重新定义覆盖。
8+
Hiproxy has some built-in variables so that you can use them directly in corresponding scopes without neither defining nor assigning. Particularly, user cannot redefine the variables to overwrite them.
119

12-
## 全局变量
10+
## Global variables
1311

14-
这些全局变量,在配置文件的**任何地方都可以使用**
12+
Global variables can **be used in everywhere of configuration files**.
1513

16-
> 提示:hiproxy暂时没有内置的全局变量。将来会添加!
14+
> Hint: hiproxy currently has not built-in variables. Some would be added in the furture.
1715
18-
## location块级变量
16+
## Location block scope variables
1917

20-
这些变量,只能在`location`块中使用,这些变量主要是存储与请求相关的一些信息,比如请求的参数(`$query_string`)、Cookie`$cookie_name`)和host(`$host`)等。现在支持的所有内置变量:
18+
You can use the variables only in `location` blocks. Then are used to store information about request, such as query string(`$query_string`), Cookie(`$cookie_name`), and host(`$host`), etc. Here are all the variables that are currently supported:
2119

2220
### $host
23-
当前请求的URL对应的`host`或者请求头部的`Host`字段。
21+
22+
The `host` correlative to the current request URL, or the `Host` field in request headers.
2423

2524
### $hostname
26-
当前请求的URL对应的`hostname`或者请求头部的`Host`字段对应的`hostname`
25+
26+
The `hostname` correlative to the current request URL, or correlative to the `Host` field in request headers.
2727

2828
### $server_port
29-
请求的服务端口号,默认`80`
29+
30+
The server port number of the request, default `80`.
3031

3132
### $search
32-
请求的参数字符串(包括`?`),比如`?from=app&v=19482848253`
33+
34+
The query string (with `?`) of the request, such as `?from=app&v=19482848253`.
3335

3436
### $query_string
35-
请求的参数字符串(**不包括`?`**),比如`from=app&v=19482848253`
37+
38+
The query string (**without `?`**), such as `from=app&v=19482848253`.
3639

3740
### $scheme
38-
请求的协议,`http`或者`https`
41+
42+
The request protocol, it's either `http` or `https`.
3943

4044
### $request_uri
41-
请求的完整地址,比如`http://hiproxy.org:8081/docs/index.html?from=google&v=_1847295727524#get-started`
45+
46+
The entire request URL, such as `http://hiproxy.org:8081/docs/index.html?from=google&v=_1847295727524#get-started`.
4247

4348
### $path
44-
请求的`path`(包括参数),比如`/docs/index.html?from=google&v=_1847295727524#get-started`
49+
50+
The request `path` (with query string), such as `/docs/index.html?from=google&v=_1847295727524#get-started`.
4551

4652
### $path_name
47-
请求的`path_name`(不包括参数),比如`/docs/index.html`
53+
54+
The request `path_name` (without query string), such as `/docs/index.html`.
4855

4956
### $base_name
50-
请求path的最后一部分,比如path为`/docs/index.html`,则$base_name为`index.html`
57+
58+
The last part of the path. For exampke, let's say the path is `/docs/index.html`, so that $base_name is `index.html`.
5159

5260
### $dir_name
53-
请求path的目录名称,比如path为`/docs/index.html`,则$dir_name为`/docs/`
61+
62+
The directory names of the path. For example, let's say path is `/docs/index.html`, so that $dir_name is `/docs/`.
5463

5564
### $hash
56-
请求url中的`hash`(包括`#`),比如'#get-started'。
65+
66+
The `hash` (with `#`) of request URL, such as `#get-started`.
5767

5868
### $hash_value
59-
请求url中的`hash`值(不包括`#`),比如'get-started'。
69+
70+
The `hash` value (without `#`) of request URL, such as `get-started`.
6071

6172
### $uri
62-
`$request_uri`
73+
74+
Same as `$request_uri`.
6375

6476
### $cookie_*name*
65-
`cookie`的值,`name`表示字段名称,这个名称中的大写字母都改成了小写,`-`替换成了`_`。比如`$cookie_userId`表示`cookie``useId`的值。
77+
78+
A `cookie` value. The `name` stands field name whose capital letters have been changed to lower ones and `-` characters have been changed to `_`. For example, `$cookie_userId` is for the value of `userId` in the `cookie`.
6679

6780
### $http_*name*
68-
请求头(request)中的字段值,`name`表示字段名称,这个名称中的大写字母都改成了小写,`-`替换成了`_`。比如请求头信息中包含`User-Agent: user agent`,可以使用变量`$http_user_agent`来获取这个值。
81+
82+
The value of a request header field. The `name` stands field name whose capital letters have been changed to lower ones and `-` characters have been changed to `_`. For example, let's say `User-Agent: user agent` is a valid request header, then `$http_user_agent` can get its value.
6983

7084
### $arg_*name*
71-
请求参数的值,`name`表示字段名称,这个名称中的大写字母都改成了小写,`-`替换成了`_`。比如请求参数为`?from=google&v=_1847295727524`,可以通过`$arg_from`来获取`from`的值。
85+
86+
The value of a request query parameter. The `name` stands field name whose capital letters have been changed to lower ones and `-` characters have been changed to `_`. For example, let's say the query string is ``?from=google&v=_1847295727524`, then `$arg_from` can get value of `from`.
7287

0 commit comments

Comments
 (0)