Setup: I have a deployed webapp on a server. And I have another machine which is a proxy.
Question: how can I ensure that the webserver can only be accessed through the proxy?
Eg: the user goes to www.myproxy.com, and is redirected to www.mywebserver.com
But he should not be able to access www.mywebserver.com directly without going first to the proxy.
Is that ever possible?
Your question is not clear, is your webserver always should be accessed through a reverse proxy or just redirect once?
If your webserver is always behind the proxy you should check the headers “Via” and “x-forwarded-for” on the web server.
the header via should contain your proxy server IP address.