Answer the question
In order to leave comments, you need to log in
Proxy *.example.com to *.localTLD?
It is necessary to proxy http requests *.example.com to *.localTLD, and if somedomain.localTLD does not resolve, you need to throw it on the default page (I think this can be done through the error page for 502 Bad gateway).
How to make such a tricky proxy with undefined domains in nginx, lighttpd, apache?
Answer the question
In order to leave comments, you need to log in
Then you can write in
server_name default; if ($host ~* (.*).example.com) { set $host_prefix $1; rewrite ^.*$ http://$host_prefix.localTLD/ permanent; }
For Nginx something like this
server { listen 0.0.0.0:80; server_name www.example.com location / { # Proxy proxy_pass http://somedomain.localTLD; # Catch errors for processing before issuing to the client proxy_intercept_errors on; # additional options if needed # for example, if you are proxying to IP, you usually need to specify the host # proxy_set_header Host 'somedomain.localTLD'; # Or # proxy_read_timeout 60; } location /pages/ { root /var/www/; } # Further error handling error_page 502 503 504 /50x.html; # Or if you need to answer 200 and give another page then # error_page 502 503 504 =200 /pages/page.html; }
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question