How can I Allow (or restrict) Access by IP Address?
How can I Allow (or restrict) Access by IP Address?
Question:
I'm running a test server and would like to restrict access to just my machine.
or
I would like to restrict a certain IP from Accessing Web Crossing
Answer:
In recent versions of Web Crossing, you can simply use the Allow/Deny list in the Web Services Control Panel to access to your site.
For earlier versions without this, you can control access at your firewall/network level, or use something like the following in WebX:
The following example uses authenticateFilter macro to restrict access to just the local machine ("127.0.0.1") and puts up a "404" page otherwise. Use this as a basis for other IP restriction schemes.
If you don't care about 404s, then just add your IP or range of IPs to the allow/deny list in the web services control panel, and then deny all others (example: a=1.2.3.4.5 or perhaps a=1.2.3.*.* is all you need to do because the d=* is implicit).
Example:
%% macro authenticateFilter %%
%% if envir.remote_addr == "127.0.0.1" %%
%% user %%
%% else %%
Error 404
HTTP Error 404
404 Not Found
The Web server cannot find the file or script you asked for. Please
check the URL to ensure that the path is correct.
Please contact the server's administrator if this problem persists.