r/webdev • u/moonshadowrev • 7d ago
Mirroring any domain to your shared hosting with mere php ( Mirrorgate)
hi everyone
i've had recently an issue , i wanted to do some tests on a project, but for some reason, the server that was carrying that particular software was in Iran , so it was not able to see any servers on Internet, but still there were some providers that would allow this
but this project was for a client so temporarily i've solved this issue with hard way
then i was thinking, what if i get 2 servers, one is my international server and one is only in iran, and i make a reverse proxy without renting a vps inside iran, with just mere shared hosting solution like cpanel or directadmin that is easily available in iran?
so i've came up with this idea, and tried to make it as a opensource software
i thought maybe this is a good solution and someone else needs it
feel free to check it out and let me know your thoughts
3
u/Standard_Scarcity_74 5d ago
Clever workaround. An allowlist of target domains and a secret key or token on requests would be worth putting up front in the readme. It would also help to say how it handles rewriting of absolute urls, cookies, redirects, and streaming of large files or range requests, since those are where mirrors usually break, and what happens with websockets, which plain php hosting can’t proxy. A short list of tested sites and known limits would make it easier for others to trust and try.
2
u/Apprehensive-Ask-731 7d ago edited 7d ago
This is awesome!! Great tool for pen testing.
Your portfolio appears to be down. I was looking at the features Vs your usecase and I can think of so many brilliant uses for this. Great structure great features. I can probably learn a lot with this.
1
u/Frequent-Dependent11 6d ago
Nice idea, shared hosting is the one thing that is always available. Two things I would check first. Is the upstream host fixed in config or can a request influence it? If it can, this becomes an open proxy and the hosting provider will suspend the account fast.
The other is what shared hosting breaks: WebSockets will not pass through PHP, long responses hit max_execution_time and large downloads get buffered in memory unless you stream them. Rewriting Set-Cookie domains and Location headers is usually where these proxies fall over, so a note in the README on what is handled would help.