Solved

ColdFusion 403 errors

Posted on 2008-06-17
4
423 Views
Last Modified: 2013-12-24
Is it possible to put restrictions on folders in ColdFusion that doesn't allow users outside the netword to access them. Is this only possible in IIS?

AN example would be if a user were mto access http://www.somesite.com/somefolderurl. If they were on the network, they would get it no problem, if they were outside the network a 403 error would display. Can this happen at a directory level if you have a couple of directories this needs to happen at?
0
Comment
Question by:asaworker
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 36

Expert Comment

by:SidFishes
ID: 21805991
There is a simple way to do a redirect to a different page by adding

<cfif not find("10.10.10.",  cgi.REMOTE_ADDR) >
<cflocation url="http://google.com">
</cfif>

to application.cfm

you would just modify the find param to match the partial ip of your local network

this isn't fool proof as IP addresses can be spoofed and only applies to files processed by cfserver ...media files or documents would not be protected for direct url access

more secure would be to set up login and authentication

search for cflogin in the documentation

you can protect media and documents by serving these files via cfcontent after login
0
 

Author Comment

by:asaworker
ID: 21806070
I am using login and authenication.. using isUserInRoleI was hoping to add a layer for the ip

<cfif isUserInRole("test") and newvar neq "test1" and newvar neq "test2" and not find("20.20.20.",  cgi.REMOTE_ADDR)>
            <cflocation url="/index.cfm" addtoken="no">
      </cfif>

But the not find doesn't seem to work right.
0
 
LVL 36

Accepted Solution

by:
SidFishes earned 500 total points
ID: 21806281
what's with the 20.20.20. ?

private network ranges should be

10.0.0.0 -      10.255.255.255
172.16.0.0 - 172.31.255.255
192.168.0.0 - 192.168.255.255

anything else is potentially an internet (ie: public) IP

in any case, you have to use find not find based on what you are trying to do.. my example says "if you are from the IP range 10.10.10.*" then go to google. you'd use only find if you want say "if you _are_ from 10.10.10.* then go to index.cfm else go to not authorized page
<cfif isUserInRole("test") and newvar neq "test1" and newvar neq "test2" and find("20.20.20.",  cgi.REMOTE_ADDR)>
<cflocation url="/index.cfm" addtoken="no">
<cflese>
<cflocation url="http://google.com">
</cfif>

Open in new window

0
 

Author Comment

by:asaworker
ID: 21807036
This is perfect, what I was looking to do.
0

Featured Post

Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Linux Hosting 16 75
IIS - one site that hosts many HTTPS domains? 3 57
How can i point a subdomain to directory? 5 38
DNS CNAME records visibility on a web server 2 39
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question