Solution#
First, let's talk about the solution. By configuring a proxy with nginx and using its replacement feature, we can modify the hardcoded judgment logic in the front-end page.
server {
# Exposed port
listen 1234;
location / {
# Management page address
proxy_pass http://192.168.0.1/;
# Key logic, replace the hardcoded domain detection in the front end
subs_filter 'tplogin.cn' 'your.domain.com';
# Set to take effect for all file types
subs_filter_types *;
}
If you encounter an error indicating that the subs_filter
module is unavailable, you can try installing nginx-extras
or compile it from source to resolve the issue.
Finally, restart the nginx
service to take effect.
# sudo systemctl restart nginx
nginx -s reload
Background#
Recently, I've been tinkering with a home cloud, applied for a public IP, and exposed some services to the wide area network.
To be continued.