Skip to content

HTTP & SOCKS — mihomo

mihomo splits the inbound side into three listener types — http, socks, and mixed (HTTP+SOCKS on one port) — each with a separate Go struct. Outbounds keep them separate: type: http and type: socks5. TLS is supported on every variant via the listener's certificate fields.

HTTP outbound

Entry under proxies: with type: http. Embeds BasicOption.

FieldTypeDefaultAllowed valuesDescription
namestring(required)<string>Unique proxy name.
serverstring(required)<host>Upstream HTTP-proxy host.
portint(required)<port>Upstream port.
usernamestring(unset)<string>HTTP Basic auth username.
passwordstring(unset)<string>HTTP Basic auth password.
tlsboolfalsetrue | falseWrap the upstream connection in TLS (HTTPS proxy).
snistring(server)<SNI>TLS Server Name Indication.
skip-cert-verifyboolfalsetrue | falseDisable TLS verification (test only).
fingerprintstring(unset)<SHA256 hex>Pin the server's TLS certificate fingerprint.
certificatestring(unset)<PEM file path>Client certificate (mTLS).
private-keystring(unset)<key file path>Private key for `certificate`.
headersmap[string]string{}{<header>: <value>}Extra HTTP headers added to every request.

Source: adapter/outbound/http.go:28-42 · pinned at v1.19.27 (5184081)

SOCKS5 outbound

Entry under proxies: with type: socks5. Embeds BasicOption.

FieldTypeDefaultAllowed valuesDescription
namestring(required)<string>Unique proxy name.
serverstring(required)<host>Upstream SOCKS host.
portint(required)<port>Upstream port.
usernamestring(unset)<string>SOCKS5 username.
passwordstring(unset)<string>SOCKS5 password.
tlsboolfalsetrue | falseWrap the SOCKS connection in TLS.
udpboolfalsetrue | falseEnable SOCKS5 UDP-associate.
skip-cert-verifyboolfalsetrue | falseDisable TLS verification (test only).
fingerprintstring(unset)<SHA256 hex>Pin the server's TLS certificate fingerprint.
certificatestring(unset)<PEM file path>Client certificate (mTLS).
private-keystring(unset)<key file path>Private key for `certificate`.

Source: adapter/outbound/socks5.go:30-43 · pinned at v1.19.27 (5184081)

HTTP inbound

Entry under listeners: with type: http. Embeds BaseOption.

FieldTypeDefaultAllowed valuesDescription
usersAuthUsers[]<AuthUsers>Accepted users. Each entry is a `user:pass` string.
certificatestring(unset)<PEM file path>Optional TLS cert (HTTPS proxy). Pair with `private-key`.
private-keystring(unset)<key file path>TLS private key.
client-auth-typestring(none)no-client-cert | request-client-cert | require-any-client-cert | verify-client-cert-if-given | require-and-verify-client-certMutual-TLS client-auth mode.
client-auth-certstring(unset)<PEM file path>CA bundle accepted as client roots.
ech-keystring(unset)<ECH config>Encrypted Client Hello material.
reality-configRealityConfig(disabled)RealityConfigREALITY server configuration.

Source: listener/inbound/http.go:14-23 · pinned at v1.19.27 (5184081)

SOCKS inbound

Entry under listeners: with type: socks. Embeds BaseOption.

FieldTypeDefaultAllowed valuesDescription
usersAuthUsers[]<AuthUsers>Accepted users.
udpboolfalsetrue | falseEnable SOCKS5 UDP-associate.
certificatestring(unset)<PEM file path>Optional TLS cert.
private-keystring(unset)<key file path>TLS private key.
client-auth-typestring(none)<see HTTP>Same as HTTP inbound.
client-auth-certstring(unset)<PEM file path>Same as HTTP inbound.
ech-keystring(unset)<ECH config>Encrypted Client Hello material.
reality-configRealityConfig(disabled)RealityConfigREALITY server configuration.

Source: listener/inbound/socks.go:14-24 · pinned at v1.19.27 (5184081)

Mixed inbound (HTTP + SOCKS)

Entry under listeners: with type: mixed. Multiplexes HTTP and SOCKS5 on a single port — the first byte of the client request decides which half handles the connection.

FieldTypeDefaultAllowed valuesDescription
usersAuthUsers[]<AuthUsers>Accepted users (shared between HTTP and SOCKS halves).
udpboolfalsetrue | falseEnable SOCKS5 UDP-associate on the SOCKS half.
certificatestring(unset)<PEM file path>Optional TLS cert.
private-keystring(unset)<key file path>TLS private key.
client-auth-typestring(none)<see HTTP>Same as HTTP inbound.
client-auth-certstring(unset)<PEM file path>Same as HTTP inbound.
ech-keystring(unset)<ECH config>Encrypted Client Hello material.
reality-configRealityConfig(disabled)RealityConfigREALITY server configuration.

Source: listener/inbound/mixed.go:15-25 · pinned at v1.19.27 (5184081)

Examples

HTTP outbound:

yaml
proxies:
  - name: http-upstream
    type: http
    server: upstream.example.com
    port: 8080
    username: alice
    password: <password>
    tls: true
    sni: upstream.example.com

SOCKS5 outbound with UDP:

yaml
proxies:
  - name: socks-upstream
    type: socks5
    server: upstream.example.com
    port: 1080
    username: alice
    password: <password>
    udp: true

Mixed inbound for client devices:

yaml
listeners:
  - name: client-mixed
    type: mixed
    listen: 127.0.0.1
    port: 7890
    users:
      - alice:<password>
    udp: true

HTTPS-proxy inbound (HTTP over TLS):

yaml
listeners:
  - name: https-proxy
    type: http
    listen: 0.0.0.0
    port: 8443
    users:
      - alice:<password>
    certificate: /etc/mihomo/server.crt
    private-key: /etc/mihomo/server.key

Notes

  • users: here is a list of user:pass strings — not a structured object array. The : separator is required. An empty list disables authentication.
  • The mixed listener accepts both HTTP and SOCKS5 on the same port, controlled by first-byte detection in the listener.
  • Top-level shortcuts (port, socks-port, mixed-port on the root RawConfig) are an alternative way to declare unauthenticated listeners — they don't go through listeners[]. Pick one approach per inbound.
  • mihomo's top-level authentication list (see Basics) applies to every legacy port (port, socks-port, mixed-port) but not to listeners: entries — those have their own users field.

Cross-core notes

  • Xray-core keeps HTTP and SOCKS in separate source files, uses accounts[] (each {user, pass}), and has no built-in "mixed" inbound. See HTTP & SOCKS — Xray-core.
  • sing-box also offers a mixed inbound, with users[] carrying structured {username, password} objects. Field names are snake_case. See HTTP & SOCKS — sing-box.

Source: adapter/outbound/http.go:28-42 · v1.19.27 (5184081)

Core Tutorial by Argsment