GithubHelp home page GithubHelp logo

Comments (4)

JangoSteve avatar JangoSteve commented on August 15, 2024

Hey Todd, I think the problem is that your page is using XHTML transitional, and Rails 3 and jQuery UJS are dependent upon HTML 5. You can see my article for the full scoop explaining the role that HTML 5 plays in remote links/forms in Rails 3.

Try using the HTML 5 declaration at the top of your layout, by replacing this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> 

With this:

<html>

from remotipart.

JangoSteve avatar JangoSteve commented on August 15, 2024

Hey Todd, I think I figured it out. The request actually is being sent to your server, but the server is returning a 404 Nginx error, which means the request isn't making it to your rails app, which explains why it's not showing up in your app's log. If you look in the "Net" tab of Firebug, you can see the request being sent and the Nginx 404 response being received.

Because of the way IE treats requests for JS data-types from the iframe that's generated by remotipart.js, remotipart has to append the '.js' extension to the request URL so that the server knows it's a JS request.

Anyway, it seems your Nginx server is not configured to accept requests for http://tuys.seebuzz.com/entries.js (or perhaps it's checking for entries.js in the public folder and not finding it), so it is returning a 404. This is why posts without file uploads work in your form; in that case, it's submitting a POST request to /entries. Meanwhile, file uploads fail; they must submit via a hidden iframe to /entries.js, which should be going to your 'entries' action with a JS format request type.

I'd say there are two solutions. a) Fix the Nginx conf to allow for /entries.js to route to your rails app as normal, or b) change the 'data-type' of your remote form to something other than JS, maybe HTML or JSON.

from remotipart.

tdewell avatar tdewell commented on August 15, 2024

Steve,

It works now. Woot!

See the nginx.conf entry for this dev server and the portion I commented out
to get remotipart working:

server {
listen 80;
server_name someserver.com;
root /home/username/someserver.com/railsapp/public;

    # serve static content directly
    #location ~* \.(ico|jpg|gif|png|css|js|swf|html)$ {
      #if (-f $request_filename) {
        #expires max;
        #break;
      #}
    #}
    passenger_enabled on;
}

Much thanks for your help!

Todd

On Sat, Mar 26, 2011 at 10:53 AM, JangoSteve <
[email protected]>wrote:

Hey Todd, I think I figured it out. The request actually is being sent to
your server, but the server is returning a 404 Nginx error, which means the
request isn't making it to your rails app, which explains why it's not
showing up in your app's log. If you look in the "Net" tab of Firebug, you
can see the request being sent and the Nginx 404 response being received.

Because of the way IE treats requests for JS data-types from the iframe
that's generated by remotipart.js, remotipart has to append the '.js'
extension to the request URL so that the server knows it's a JS request.

Anyway, it seems your Nginx server is not configured to accept requests for
http://tuys.seebuzz.com/entries.js (or perhaps it's checking for
entries.js in the public folder and not finding it), so it is returning a
404. This is why posts without file uploads work in your form; in that case,
it's submitting a POST request to /entries. Meanwhile, file uploads fail;
they must submit via a hidden iframe to /entries.js, which should be going
to your 'entries' action with a JS format request type.

I'd say there are two solutions. a) Fix the Nginx conf to allow for
/entries.js to route to your rails app as normal, or b) change the
'data-type' of your remote form to something other than JS, maybe HTML or
JSON.

Reply to this email directly or view it on GitHub:
https://github.com/formasfunction/remotipart/issues/16#comment_920756

from remotipart.

JangoSteve avatar JangoSteve commented on August 15, 2024

Awesome, glad it worked out. You probably still want Nginx to server static files directly for the most part, so your ruby instances aren't spinning up for every static file request. Perhaps instead of commenting all that out, you could just remove the ".js" extension from the list of static file-type matches. So change this:

location ~* \.(ico|jpg|gif|png|css|js|swf|html)$ {

To this:

location ~* \.(ico|jpg|gif|png|css|swf|html)$ {

from remotipart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.