[GH-ISSUE #1492] Feature request: cool neat fallback configuration for Reality and website at same host #618

Open
opened 2026-10-13 20:25:13 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @TheCarrotCR on GitHub (Mar 26, 2025).
Original GitHub issue: https://github.com/amnezia-vpn/amnezia-client/issues/1492

I have a self-hosted VPN deployed via Amnezia, and at some point I've decided to deploy a website on the same hosting with it, as it's cool and safe. So to achieve what I wanted, I've had to go inside of amnezia-xray container and modify xray config like this:

"settings": {
    "clients": [
        {
            "flow": "xtls-rprx-vision",
            "id": ...
        },
        ...
    ],
    "decryption": "none",
    "fallbacks": [
        {
            "dest": "my.ip.add.ress:4433",
            "name": "myhostname.org",
            "xver": 1
        },
        {
            "dest": 443
        }
    ]
},
"streamSettings": {
    "network": "tcp",
    "realitySettings": {
        "dest": "myhostname.org:4433",
        "privateKey": "<private key>",
        "serverNames": [
            "myhostname.org"
        ],
        "shortIds": [
            "myShortId123456"
        ]
    },
    "security": "reality"
}

I'm not a complete noob, but all of this reverse-proxying and xraying stuff is new to me, so I've had to do my homework to figure all this out. I still barely understand some of details about how it works - for example, not only myhostname.org opens a website now, but even myotherhostname.org for same host works as well. I'm pretty sure that the idea is somehow bad and what I've done is somehow terrible, though I don't know how it's bad specifically and if it's bad at all.

So, the thing is, if I share this connection, or change a hostname, or do a loud noise, then I will lost my beautiful tiny config. Not really a big deal, but kinda annoying. So, The Feature request: can you please add an ability to configure fallbacks like I did (or maybe some better option if it's actually bad) to use my own site as a fallback and redirect destination (with port specified)? Or atleast just preserve non-required parts of a config untouched, so it wouldn't overwrite my fallback and port. Thank you for a great job and hope this will be implemented.

Originally created by @TheCarrotCR on GitHub (Mar 26, 2025). Original GitHub issue: https://github.com/amnezia-vpn/amnezia-client/issues/1492 I have a self-hosted VPN deployed via Amnezia, and at some point I've decided to deploy a website on the same hosting with it, as it's cool and safe. So to achieve what I wanted, I've had to go inside of amnezia-xray container and modify xray config like this: ``` "settings": { "clients": [ { "flow": "xtls-rprx-vision", "id": ... }, ... ], "decryption": "none", "fallbacks": [ { "dest": "my.ip.add.ress:4433", "name": "myhostname.org", "xver": 1 }, { "dest": 443 } ] }, "streamSettings": { "network": "tcp", "realitySettings": { "dest": "myhostname.org:4433", "privateKey": "<private key>", "serverNames": [ "myhostname.org" ], "shortIds": [ "myShortId123456" ] }, "security": "reality" } ``` I'm not a _complete_ noob, but all of this reverse-proxying and xraying stuff is new to me, so I've had to do my homework to figure all this out. I still barely understand some of details about how it works - for example, not only myhostname.org opens a website now, but even myotherhostname.org for same host works as well. I'm pretty sure that the idea is somehow bad and what I've done is somehow terrible, though I don't know how it's bad specifically and if it's bad at all. So, the thing is, if I share this connection, or change a hostname, or do a loud noise, then I will lost my beautiful tiny config. Not really a big deal, but kinda annoying. So, **The Feature request**: can you please add an ability to configure fallbacks like I did (or maybe some better option if it's actually bad) to use my own site as a fallback and redirect destination (with port specified)? Or atleast just preserve non-required parts of a config untouched, so it wouldn't overwrite my fallback and port. Thank you for a great job and hope this will be implemented.
Author
Owner

@TheCarrotCR commented on GitHub (Mar 28, 2025):

I've done some more research, as it turns out that if I add this server on a new device, then xray wouldn't work for it. My guess it that it's because client by default thinks it should use googletagmanager.com or whatever default redirect address is. It's not reading configs or whatever, so flow like this:

  1. Add server on a new device, skipping initial server-side installs
  2. Scan for existing Amnezia services

would not work if config has been changed to use other url, though I've been using client functionality to initialize config and only modifications were adding a port and fallback.

In my opinion, it's not even a feature request anymore with that addition, it's actually more of a bug induced by lack of a feature. It can't be reproduced without modifying a config inside of a docker container, and as it seems Amnezia tends to work as-is and is not intended to use like I do, so I don't think I should duplicate issue to label it as bug. But it's clearly something to be done, I mean it's not that unintended to use X-ray on the same host where redirect website is hosted.

<!-- gh-comment-id:2761429943 --> @TheCarrotCR commented on GitHub (Mar 28, 2025): I've done some more research, as it turns out that if I add this server on a new device, then xray wouldn't work for it. My guess it that it's because client by default thinks it should use googletagmanager.com or whatever default redirect address is. It's not reading configs or whatever, so flow like this: 1. Add server on a new device, skipping initial server-side installs 2. Scan for existing Amnezia services would not work if config has been changed to use other url, though I've been using client functionality to initialize config and only modifications were adding a port and fallback. In my opinion, it's not even a feature request anymore with that addition, it's actually more of a bug induced by lack of a feature. It can't be reproduced without modifying a config inside of a docker container, and as it seems Amnezia tends to work as-is and is not intended to use like I do, so I don't think I should duplicate issue to label it as bug. But it's clearly something to be done, I mean it's not _that_ unintended to use X-ray on the same host where redirect website is hosted.
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
amnezia-vpn/amnezia-client#618
No description provided.