Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

145
Views
How to authorize reading of directories and limit the downloading of files to only authenticated users on Apache 2.4?

I want to authorize the consultation of directories hosted on Apache 2.4 and limit the downloading of files to only authenticated users.

The files are very large and cannot be downloaded via scripting language due to memory limitation.

Is there an alternative of the Nginx ngx_http_auth_request_module module on Apache?

I want to migrate my Nginx web server to Apache 2.4, here is the solution I am currently using on Nginx:

Nginx configuration

location ~ .+(?<!/)$ 
{ 
    auth_request /auth.php;
    error_page 401 = @login;
}

location @login 
{
    internal;
    return 302 /account/login.php;
}

auth.php

ob_start();
session_start();

if( isset($_SESSION['logged_in']) && $_SESSION['logged_in'] == true ) {

    header("HTTP/1.1 200 OK");

} else {

    header("HTTP/1.1 401 Unauthorized");
}
over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!