Hey, I have a rails app and I am already redirecting nearly all traffic to use https. However, there is a particular path in my app which I need accessible by plain http, say somedomain.com/special
.
I am wondering if this is even possible, as my rails app seems to be defined in the https block. Perhaps if there's some way to host it both on http and https, then redirect all traffic from http to https if it is not /special
? (I also need /RPC2
to be on http, but that's not a rails path which is why that does work right now).
I would greatly appreciate any advice. If you see any glaring mistakes in my configuration I would also appreciate it if you pointed them out!
server {
listen 80;
server_name somedomain.com;
location / {
rewrite ^ https://somedomain.com$request_uri? permanent;
}
location /RPC2 {
include scgi_params;
scgi_pass 127.0.0.1:5000;
auth_basic "app";
auth_basic_user_file /var/www/server/basic.auth;
}
}
server {
listen 443 default ssl;
server_name somedomain.com;
root /var/www/sites/app/current/public;
passenger_enabled on;
rails_env production;
ssl_certificate /etc/ssl/certs/myssl.crt;
ssl_certificate_key /etc/ssl/certs/myssl.key;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
location /downloads {
autoindex on;
autoindex_exact_size off;
auth_basic "node";
auth_basic_user_file /var/www/server/basic.auth;
alias /var/www/downloads/;
}
}
Thanks again!