Skip to content

Can we rewrite hosts or access ips directly with xray configs? #101

@unacoder

Description

@unacoder

This is two different questions, one is can we rewrite SNI, e.g steam uses both akamai and fastly, it uses akamai by default and I use Redirector firefox extension to redirect to fastly version and proxy server uses domain front fronting to fetch asset. Second one is can we use ip as SNI? e.g ghcr.io can be fronted using ip as SNI (I got this idea from your v13 commit, was this intention there? cause it's not working there)

I tried to implement similar approach in mhr but wasn't fully versed in tls and rustls so dropped it completely, my main problem there was ssl verification

Bellow are some examples that explain it better


Domains working this way:

["avatars.fastly.steamstatic.com",
"avatars.steamstatic.com",
"shared.fastly.steamstatic.com",
"shared.steamstatic.com",
"community.fastly.steamstatic.com",
"community.steamstatic.com",
"store.fastly.steamstatic.com",
"store.steamstatic.com",
"cdn.fastly.steamstatic.com",
"cdn.steamstatic.com"]
# origin: https://store.akamai.steamstatic.com/public/javascript/applications/store/manifest.js?v=snaAd7XpTcDT&l=english&_cdn=akamai
curl -http2 -i --resolve="*:443:151.101.2.137" -H "Host: store.fastly.steamstatic.com" "https://crates.io/public/javascript/applications/store/manifest.js?v=snaAd7XpTcDT&l=english&_cdn=fastly"
# HTTP/2 200
# server: nginx
# content-type: text/javascript;charset=UTF-8
# cache-control: public,max-age=15552000
# expires: Tue, 03 Nov 2026 18:32:32 GMT
# etag: "snaAd7XpTcDT"
# x-integrity: "sha384-CJm0TLxz6pOpMYjs/GvYQvfziIKvZucMdQLmMwaNp6GG8tEYH/4PHKjKO4cXTWdv"
# last-modified: Sun, 09 Sep 2001 01:46:40 GMT
# content-encoding: gzip
# strict-transport-security: max-age=63072000
# accept-ranges: bytes
# age: 508781
# date: Wed, 13 May 2026 15:52:13 GMT
# via: 1.1 varnish
# x-served-by: cache-fra-eddf8230107-FRA
# x-cache: MISS, HIT
# x-cache-hits: 0
# x-timer: S1778687534.634046,VS0,VE1
# content-length: 12937
# 
# Warning: Binary output can mess up your terminal. Use "--output -" to tell curl to output it to your terminal anyway, or
# Warning: consider "--output <FILE>" to save to a file.

Domains working this way:

["git.io",
"github.community",
"ghcr.io"]
dig +short -4 A ghcr.io
# 140.82.121.33
curl -k -http2 -i -H "Host: ghcr.io" "https://140.82.121.33/v2"
# HTTP/2 404
# content-type: application/json
# docker-distribution-api-version: registry/2.0
# strict-transport-security: max-age=63072000; includeSubDomains; preload
# date: Wed, 13 May 2026 15:38:29 GMT
# content-length: 18
# x-github-request-id: D62A:70FE1:D15C78:D9A468:6A049AF5
#
# 404 page not found%
dig +short -4 A github.community
# 140.82.113.17
curl -k -i -H "Host: github.community" https://140.82.112.17/t/cd-command-doesnt-work/169987
# HTTP/2 301
# content-length: 0
# location: https://github.com/orgs/community/discussions/26631

Some .akamai.steamstatic.com sites also can be accessed by ip (haven't tested all yet)

dig +short -4 A store.akamai.steamstatic.com
# 2.16.238.10
# 2.16.238.28
curl -k -I -H "Host: store.akamai.steamstatic.com" "https://2.16.238.10/public/javascript/applications/store/manifest.js?v=snaAd7XpTcDT&l=english&_cdn=akamai"
# HTTP/1.1 200 OK
# Server: nginx
# Content-Type: text/javascript;charset=UTF-8
# ETag: "snaAd7XpTcDT"
# X-Integrity: "sha384-CJm0TLxz6pOpMYjs/GvYQvfziIKvZucMdQLmMwaNp6GG8tEYH/4PHKjKO4cXTWdv"
# Last-Modified: Sun, 09 Sep 2001 01:46:40 GMT
# Strict-Transport-Security: max-age=63072000
# Cache-Control: public, max-age=15041535
# Expires: Tue, 03 Nov 2026 18:32:31 GMT
# Date: Wed, 13 May 2026 16:20:16 GMT
# Connection: keep-alive

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions