WeBWorK Main Forum

403 Forbidden Error

403 Forbidden Error

by Marie-Claude Bonneau -
Number of replies: 5

Hello,

We are experiencing a 403 Forbidden Error and I would need some assistance to fix it.

The problem occurs when we are trying to view graphs. For example, if I try to view the problem rochesterLibrary/setAlgebra16FunctionGraphs/c0s1p1/c0s1p1.pg, I get windows with an x as opposed to graphs. When I click on the window, the following error appears

Forbidden

You don't have permission to access /webwork2_course_files/Calculus_I_NYA_MC/tmp/gif/Undefined_Set-prob6-2-96187.gif on this server.

I have located where the gif file was (it was actually in a different directory) and retyped the path without any luck. I was not granted access. I changed the access to the directory (chmod 755) and still no luck.

I have however observed a very odd behavior: I can actually access the problem from my Calculus II course. When I click on the image, the following address is reported in the window

/webwork2_course_files/Calculus_II_NYB_MC/tmp/gif/Undefined_Set-prob6-2-96187.gif

It thus looks like the path is not the problem. Is it my access through Apache? The difference between those two courses is that the Calculus I course was created in May 2007 while the Calculus II course was created in May 2008. Is there a year restriction setting that I have to change somewhere?

I am not too familiar with Apache and I do not know if I should be looking at the httpd.conf file or the .htaccess (recommendations I found on the Web).

Thank you in advance for your help

Marie-Claude

In reply to Marie-Claude Bonneau

Re: 403 Forbidden Error

by Marie-Claude Bonneau -

I have just realized that I have given the IP address to our server. Should that be a concern? If yes, could the administrator remove this IP address from the post?

Marie-Claude

In reply to Marie-Claude Bonneau

Re: 403 Forbidden Error

by Davide Cervone -
I've removed the IP address for you.

I don't think it is a directory permissions problem but rather an httpd configuration issue. You might try looking in the httpd error log for more information (it should say more about why the access is forbidden).

Access to the course files URL's is set up via the webwork.apache-conf file in webwork2/conf, so you might start there to see that acces is granted properly. Since you can access the files in one course, you might look for where the difference in name might affect the rules in that file.

You are also right that .htaccess files could be the problem. I would look for .htaccess files anywhere within the directory structure for the course (the course directory, its html directory, the tmp subdirectory, the gif subdirectory of that). If you have stored the tmp files in another location, look for .htaccess files in that directory hierarchy as well.

Davide
In reply to Davide Cervone

Re: 403 Forbidden Error

by Marie-Claude Bonneau -

Thank you Davide for removing the IP address.

I honestly do not know what I should be looking for...

The webwork.apache-config file was last modified in 2007, that is, at the time I installed WebWork on our server. Same thing for the httpd.conf file. Is there something in that initial setting that would deny access to a 2007 course?

I could not find any .htaccess files.

There is no difference between the course config file of Calculus_I and the course config file of Calculus_II.

I searched the config files under /webwork2 and /apache2 for the word "Calculus". I did not find any reference to either Calculus courses.

I did not find the httpd error file to be valuable (maybe I was looking at the wrong file). It said "file not found".

Any ideas as to what I should be looking for?

Thank you

Marie-Claude

In reply to Marie-Claude Bonneau

Re: 403 Forbidden Error

by Davide Cervone -
The webwork.apache-config file was last modified in 2007, that is, at the time I installed WebWork on our server. Same thing for the httpd.conf file. Is there something in that initial setting that would deny access to a 2007 course?
It's probably not the webwork.apache-config file (unless you have done some non-standard file-name matching). If the only change from the distribution is editing the $webwork_dir variable, then that file is probably OK.

I could not find any .htaccess files.
DId you use commands that would show the "hidden" files? Filenames starting with dots usually are not shown in directory listing, so .htaccess files won't show up unless you take special care when looking for them. For example
    ls -a
would list them in the directory you are cd'ed to, and
  find . -name .htaccess
would find them in the current directory and any of its sub directories. Remember that you have to look in EVERY directory that is above the file you are having trouble accessing. In your case, that would probably be
    /opt/webwork2/courses/Calculus_I_NYB_MC/tmp/gif
    /opt/webwork2/courses/Calculus_I_NYB_MC/tmp
    /opt/webwork2/courses/Calculus_I_NYB_MC
    /opt/webwork2/courses
    /opt/webwork2
and
  /opt
(but since it works for Calculus_II, the last three are unlikely to be it).

You should also check the file permissions on ALL these directories, not just the bottom gif. I'm wondering if the tmp or Calculus_I_NYB_MC directories doesn't allow the server to read the directory.

There is no difference between the course config file of Calculus_I and the course config file of Calculus_II.
It is unlikely to have to do with the course.conf files.

I searched the config files under /webwork2 and /apache2 for the word "Calculus". I did not find any reference to either Calculus courses.
It is unlikely to be something that refers to Calculus directly. There are pattern-matching commands in the httpd configuration files that are the ones that re-route the requests for the static files. The http error log should list the re-routed addresses, so you can see if the files being requested are being sent to the correct file or not.

did not find the httpd error file to be valuable (maybe I was looking at the wrong file). It said "file not found".
Well, that would be the result of a 404 error, not a 403 error, so you may not be looking at the right line of the file (or not the right file, as you suggest). You should see something like
    client denied by server configuration: /opt/webwork2/courses/Calculus_I_NYB_MC/tmp/gif/Und...
or
    Permission denied: access to /opt/webwork2/courses/Calcu...rob6-2-96187.gif failed because
         search permissions are missing on a component of the path
or something along those lines.

The actual error message could tell you something about the cause of the error. The first message above, for example, says that an apache configuration file is what is causing the denial (either the main httpd.conf file or a .htaccess file, or perhaps the webwork.apache-config file). The second error probably is due to a permission problem on one of the directories.

See if any of that helps.

Davide

In reply to Davide Cervone

Re: 403 Forbidden Error

by Marie-Claude Bonneau -

I think I have found the problem. My soft links are all broken! In the Calculus_I_NYA_MC directory, the gif files are pointing to Calculus_I_NYA/templates while in the Calculus_II_NYB_MC directory, the gif files are pointing to Calculus_II_NYB_MC/templates

The "MC" was removed from the Calculus I path. I have no idea how this happened but at least I can fix it.

Just for completeness, I really do not have any .htaccess file.

Thank you for your time and help

Marie-Claude