I am developing an RoR application on mac OSX.
In order to be able to access my app on http://localhost
, and in order to support SSL in my tests, I use nginx as a proxy to my Webrick port 3000 with the following configuration:
server {
listen 80;
server_name app.mysite.com;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
proxy_pass http://127.0.0.1:3000;
}
}
server {
listen 443 ssl;
server_name secure.app.mysite.com;
ssl on;
ssl_certificate ssl/server.crt;
ssl_certificate_key ssl/server.key;
keepalive_timeout 600;
ssl_session_timeout 10m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://127.0.0.1:3000;
### force timeouts if one of backend is died ##
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
### Set headers ####
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
### Most PHP, Python, Rails, Java App can use this header ###
proxy_set_header X-Forwarded-Proto https;
### By default we don't want to redirect it ####
proxy_redirect off;
}
}
When I access the application on either http://localhost/
or https://localhost/
the server responds quickly, and the overhead over http://localhost:3000
is negligible.
However, when I try to access my machine from another computer on the same network (for example http://10.0.1.9/
) the server responds extremely slowly, or doesn't respond at all.
It seems like nginx is not even sending an internal request to port 3000 in this case, although requests are reaching nginx from the outside for sure, and request to port 3000 from the outside are really fast.
It's important to notice that my app is running in dev mode, and my assets (which are quite a lot) are not precompiled.
Is there another option other than nginx to easily expose my dev site on my network, that is as easy to configure, and supports SSL?
Thanks, Ariel