Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ColdFusion 403 errors

Posted on 2008-06-17
4
Medium Priority
?
431 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
  • 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 2000 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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

876 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