Xray-docs-next/docs/en/config/inbounds/http.md

80 lines
2.2 KiB
Markdown
Raw Normal View History

2021-05-26 11:05:53 +00:00
# HTTP
HTTP protocol.
2021-05-26 11:05:53 +00:00
::: warning
**The HTTP protocol does not provide encryption for transmission and is not suitable for transmission over public networks, as it can easily be used as a target for attacks.**
2021-05-26 11:05:53 +00:00
:::
The more meaningful use of `http` inbound is to listen in a local network or on the local machine to provide local services for other programs.
2021-05-26 11:05:53 +00:00
::: tip TIP 1
`http proxy` can only proxy the TCP protocol and cannot handle protocols based on UDP.
2021-05-26 11:05:53 +00:00
:::
::: tip TIP 2
In Linux, you can use the following environment variables to enable global HTTP proxy for the current session (many software support this setting, but some may not).
2021-05-26 11:05:53 +00:00
- `export http_proxy=http://127.0.0.1:8080/` (Change the address to the configured inbound HTTP proxy address)
2021-05-26 11:05:53 +00:00
- `export https_proxy=$http_proxy`
- :::
2021-05-26 11:05:53 +00:00
## InboundConfigurationObject
```json
{
"timeout": 0,
"accounts": [
{
"user": "my-username",
"pass": "my-password"
}
],
"allowTransparent": false,
"userLevel": 0
}
```
> `timeout`: number
The idle timeout in seconds. The default value is `300`, and 0 means no timeout.
2021-05-26 11:05:53 +00:00
When handling a connection, if no data is transmitted within the timeout period, the connection will be terminated.
2021-05-26 11:05:53 +00:00
> `accounts`: \[[AccountObject](#accountobject)\]
An array where each element represents a user account. The default value is an empty array.
2021-05-26 11:05:53 +00:00
When `accounts` is not empty, the HTTP proxy will perform Basic Authentication verification for inbound connections.
2021-05-26 11:05:53 +00:00
> `allowTransparent`: true | false
When set to `true`, it will forward all HTTP requests instead of just proxy requests.
2021-05-26 11:05:53 +00:00
::: tip
Enabling this option without proper configuration may cause an infinite loop.
2021-05-26 11:05:53 +00:00
:::
> `userLevel`: number
The user level that the connection will use to determine the corresponding [Local Policy](../policy.md#levelpolicyobject).
2021-05-26 11:05:53 +00:00
The value of `userLevel` corresponds to the value of `level` in the [policy](../policy.md#policyobject). If not specified, the default value is 0.
2021-05-26 11:05:53 +00:00
### AccountObject
```json
{
"user": "my-username",
"pass": "my-password"
}
```
> `user`: string
The username. It is a string and is required.
2021-05-26 11:05:53 +00:00
> `pass`: string
The password. It is a string and is required.