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 8013911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:46:11+00:00 2026-06-04T19:46:11+00:00

On page: http://code.google.com/p/modwsgi/wiki/FileWrapperExtension , Graham Dumpleton recommends the following: Do note however that for

  • 0

On page: http://code.google.com/p/modwsgi/wiki/FileWrapperExtension , Graham Dumpleton recommends the following:

“Do note however that for the best performance, static files should
always be served by a web server. In the case of mod_wsgi this means
by Apache itself rather than mod_wsgi or the WSGI application.”

I’d like to pre-build a large number of static pages, then have a python program (running under apache/mod_wsgi 3.3/python3.1, daemon mode, no django involved) decide which of them to serve to each user. I’d like the python program to decide, for example, that this guy needs “12345.html” and have it tell Apache, “please serve static file ‘12345.html’ to this guy”, rather than having to use python to open the file, read the contents, turn it into a python string, and return it to mod_wsgi as “[output]”.

Is this possible? If so, how?

If not, what’s the best way to do this?

  • 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-06-04T19:46:13+00:00Added an answer on June 4, 2026 at 7:46 pm

    There are numerous ways one could do it.

    1. X-Sendfile implemented by mod_xsendfile and Apache.
    2. Location/mod_rewrite tricks using mod_wsgi daemon mode.
    3. X-Accel-Redirect if also using nginx as front end to Apache.

    Read up on (1) and (3) as more widely used options.


    Update with instructions for (2).

    Have the WSGI application return a 200 response with empty body and ‘Location’ response header with URL path to local resource hosted on same Apache server and mod_wsgi when daemon mode is being used will trigger an internal redirect to that URL.

    Thus if your Apache has:

    Alias /generated-files/ /some/path/
    <Directory /some/path>
    Order allow, deny
    Allow from all
    </Directory>
    

    then generate your file as /some/path/foo.txt in file system and then have the ‘Location’ response header have value ‘/generated-files/foo.txt’ and it will be served up.

    Note that anything under ‘/generated-files’ is publicly accessible. If you didn’t want this and wanted it to be private and so only returnable via the specific request which generated the ‘Location’ response header, you need to add mod_rewrite magic that blocks access to that URL except for an internally generated sub request. That from memory needs to be something like:

    RewriteCond %{IS_SUBREQ} false
    RewriteRule ^/generated-files/ - [F]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From the following page (http://code.google.com/p/appengine-pipeline/wiki/GettingStarted) I have seen the following code in an example
here is code that I have: agent = Mechanize.new page = agent.get 'http://google.com' page.save
What's the difference between local/html5 on this page: http://code.google.com/p/jquery-jstore/wiki/DefaultEngines I was under the impression
I read http://code.google.com/speed/page-speed/docs/caching.html . It says that proxy servers may cache cookies. I need
Running the example source at http://code.google.com/p/selenium/wiki/GettingStarted It runs successfully, however Eclipse throws bunch of
On this AutoFac Best Practices page ( http://code.google.com/p/autofac/wiki/BestPractices ), they say: Don't Pass the
The MustangPeak Common Library (http://code.google.com/p/mustangpeakcommonlib/) contains the following code that converts a method to
I am pretty much following the example on this MSDN page: http://code.msdn.microsoft.com/Imoprt-Data-from-Excel-to-705ecfcd with 1
On this page: http://code.google.com/apis/accounts/docs/OAuth2UserAgent.html Google gives instructions for doing oauth with client side applications
From the GWT page ( http://code.google.com/webtoolkit/doc/latest/DevGuideUiCss.html#cssfiles ), it mentions 2 ways (for modern application):

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.