Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4000326
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:46:04+00:00 2026-05-20T07:46:04+00:00

This is mostly a philosophical question about the best way to interpret the HTTP

  • 0

This is mostly a philosophical question about the best way to interpret the HTTP spec. Should a directory with no directory index (e.g. index.html) return 404 or 403? (403 is the default in Apache.)

For example, suppose the following URLs exist and are accessible:

http://example.com/files/file_1/
http://example.com/files/file_2/

But there’s nothing at:

http://example.com/files/

(Assume we’re using 301s to force trailing slashes for all URLs.)

I think several things should be taken into account:

  • By default, Apache returns 403 in this scenario. That’s significant to me. They’ve thought about this stuff, and they made the decision to use 403.
  • According to W3C, 403 means “The server understood the request, but is refusing to fulfill it.” I take that to mean you should return 403 if the URL is meaningful but nonetheless forbidden.
  • 403 might result in information disclosure if the client correctly guesses that the URL maps to a real directory on disk.
  • http://example.com/files/ isn’t a resource, and the fact that it internally maps to a directory shouldn’t be relevant to the status code.
  • If you interpret the URL scheme as defining a directory structure from the client’s perspective, the internal implementation is still irrelevant, but perhaps the outward appearance should indeed have some bearing on the status codes. Maybe, even if you created the same URL structure without using directories internally, you should still use 403s, because it’s about the client’s perception of a directory structure.

In the balance, what do you think is the best approach? Should we just say “a resource is a resource, and if it doesn’t exist, it’s a 404?” Or should we say, “if it has slashes, it looks like a directory to the client, and therefore it’s a 403 if there’s no index?”

If you’re in the 403 camp, do you think you should go out of your way to return 403s even if the internal implementation doesn’t use directories? Suppose, for example, that you have a dynamic web app with this URL: http://example.com/users/joe, which maps to some code that generates the profile page for Joe. Assuming you don’t write something that lists all users, should http://example.com/users/ return 403? (Many if not all web frameworks return 404 in this case.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T07:46:04+00:00Added an answer on May 20, 2026 at 7:46 am

    The first step to answering this is to refer to RFC 2616: HTTP/1.1. Specifically the sections talking about 403 Forbidden and 404 Not Found.

    • 10.4.4 403 Forbidden

    The server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated. If the request method was not HEAD and the server wishes to make public why the request has not been fulfilled, it SHOULD describe the reason for the refusal in the entity. If the server does not wish to make this information available to the client, the status code 404 (Not Found) can be used instead.

    • 10.4.5 404 Not Found

    The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address. This status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable.

    My interpretation of this is that 404 is the more general error code that just says "there’s nothing there". 403 says "there’s nothing there, don’t try again!".

    One reason why Apache might return 403 on directories without explicit index files is that auto-indexing (i.e. listing all files in it) is disabled (a.k.a "forbidden"). In that case saying "listing all files in this directory is forbidden" makes more sense than saying "there is no directory".

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is mostly a theoretical question I'm just very curious about. (I'm not trying
How would I go about this? I have a mostly static site, which is
As a lot of people pointed out in this question , Lisp is mostly
I've seen this question a few times but they mostly have to do with
I think this mostly applies to web applications, since you often see things like
this is the scenario: multiple web systems (mostly lampp/wampp) exist, most of them with
I've managed to mostly ignore all this multi-byte character stuff, but now I need
Not quite sure how to troubleshoot this. I'm maintaining an ASP site, its mostly
I believe this mostly applies to custom dialog boxes being put into DLLs, but
Following this tutorial and this question , I attempted to create a custom UIViewController

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.