Frequently Asked Questions

Dec 10, 2024 - 03:21pm

 [F] Frequently Asked Questions  / Operational Questions  /

How can I Allow (or restrict) Access by IP Address?

Rate This FAQ
 (Not yet rated)

Created On: 7 Dec 1999 11:38 am
Last Edited: 14 Feb 2005 11:25 am

Question Printer Friendly

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 %%
<html><head><title>Error 404</title>
</head>
<body>
<h2>HTTP Error 404</h2>
<p><strong>404 Not Found</strong></p>
<p>The Web server cannot find the file or script you asked for. Please check the URL to ensure that the path is correct.</p>
<p>Please contact the server's administrator if this problem persists.</p>
</body></html>
%% endif %%

%% endmacro %%