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

  • SEARCH
  • Home
  • 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 8396845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:38:24+00:00 2026-06-09T20:38:24+00:00

I’m using Rails 3.1 and NGINX. What I do with my websites is I

  • 0

I’m using Rails 3.1 and NGINX.

What I do with my websites is I use a URL hashbang + popstate trick to reload the URL while then using AJAX to download the next page. Rails then recognizes that this is a AJAX request and then delivers the view without the layout (or a stripped down version). This works, but when I try to cache the output into my own extension (called plain_html) then NGINX doesn’t allow the URL rewriting to work.

I’m caching my Rails page cached files into a cache directory located on the public folder. These are my URL rewrites for my HTML files.

    if (-f $document_root/cache/$uri/index.html) {
      rewrite (.*) /cache/$1/index.html break;
    }
    if (-f $document_root/cache/$uri.html) {
      rewrite (.*) /cache/$1.html break;
    }
    if (-f $document_root/cache/$uri) {
      rewrite (.*) /cache/$1 break;
    }

The first two are for anything that is without a HTML extension and the final one is a catch all for anything in the cache folder. The last one should basically work for anything that has a different extension and that is found within the cache folder like:

GET /articles # -> /cache/articles.html
GET /articles.html # -> /cache/articles.html
GET /articles.plain_html # -> /cache/articles.plain_html

This does not seem to work for the final option. It forces the browser to download it (if I access it in the address bar) and the contents of the downloaded file are not the cached contents (I tried adding words directly into the cache file).

I’ve configured NGINX to add this as a mime_type and I’m sure that the mime type does work because when I do:

GET /cache/articles.plain_html # -> this works fine

It works directly. So something is going on with the rewriting. Any ideas as to what I should do?

BTW this plain_html rewriting technique works fine using Apache.

  • 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-09T20:38:25+00:00Added an answer on June 9, 2026 at 8:38 pm

    The solution is to register a mime-type within NGINX for the plain_html file or set the default_type to content/html.

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

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I want use html5's new tag to play a wav file (currently only supported

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.