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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T21:13:44+00:00 2026-05-11T21:13:44+00:00

I have Nginx as my front-end web server listening on port 80. And certain

  • 0

I have Nginx as my front-end web server listening on port 80. And certain requests, I’ve set up nginx to reverse proxy it to a mochiweb based web server that I’ve written, listening on Port 8000. My nginx configuration for this looks like this:

location /mymochiserver {

            proxy_pass         http://127.0.0.1:8000;
            proxy_redirect     off;

            proxy_set_header   Host             $host;
            proxy_set_header   X-Real-IP        $remote_addr;
            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;

            client_max_body_size       10m;
            client_body_buffer_size    128k;

            proxy_connect_timeout      90;
            proxy_send_timeout         90;
            proxy_read_timeout         90;

            proxy_buffer_size          4k;
            proxy_buffers              4 32k;
            proxy_busy_buffers_size    64k;
            proxy_temp_file_write_size 64k;
        }

Now, when I access the URL http://localhost/mymochiserver I don’t see a response on the browser. The browser just says “Waiting for localhost”. mymochiserver prints some trace to the terminal window from which it is run, whenever a user connects to it, and right now, I do see the trace for each browser window I open to connect this URL. But I don’t see any of the output I’m expecting to see being written to the browser. BUT, when I directly access the URL http://127.0.0.1:8000/ everything works fine, and I see the output from mymochiserver on the browser. So it works when directly called. But when reverse-proxied through nginx, it doesn’t seem to be working. Any idea what could be wrong?


Update:
In my Mochiweb application I have these lines of code:

Socket = Req:get(socket),
inet:setopts(Socket, [{active, once}]),
proc_lib:hibernate(?MODULE, feed, [Response, Userid, 1]);

It is basically a COMET application where users will connect to the mymochiserver and the server pushes out data to all the connected clients. If there is no data to be sent from the server, I hibernate the process. And then when woken up, I call the feed function to send out the data. And if I remove the hibernation code, everything works well, and I see output in the browser. But if I do hibernate, it doesn’t work. Any idea what’s going wrong?

  • 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-11T21:13:44+00:00Added an answer on May 11, 2026 at 9:13 pm

    Fixed!

    Reference: http://timanovsky.wordpress.com/2009/01/09/toward-a-million-user-long-poll-http-application-nginx-erlang-mochiweb/

    I had to turn off proxy buffering and increase the proxy_read_timeout in nginx to make it work. So my config file looks like this now:

    location /mymochiapp {
                proxy_pass         http://127.0.0.1:8000;
                proxy_redirect     off;
    
                proxy_set_header   Host             $host;
                proxy_set_header   X-Real-IP        $remote_addr;
                proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
    
                client_max_body_size       10m;
                client_body_buffer_size    128k;
    
                proxy_connect_timeout      90;
                proxy_send_timeout         90;
                proxy_read_timeout         3600;
    
                proxy_buffering off;
            }
    

    Thank you thomas55 for pointing out the answer!

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

Sidebar

Related Questions

I am running nginx 0.6.32 as a proxy front-end for couchdb. I have my
I have nginx setup, acting as a reverse proxy to apache. However, I need
I have nginx acting as a reverse proxy to apache. I now need to
I have nginx all set up for my needs... it's a wildcard directory based
I have setup nginx as a front end to an node.js app. My nginx
I have an nginx up at the front serving as a proxy to two
I have got a dedicated server that has nginx web server located in a
I have Nginx in front of a Node.js app. I have it set up
I have a server where nginx serves as a front load balancer and Apache
I have installed Nginx 1.2.0 with Passenger on my Mac Mini running Lion Server.

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.