Skip to content

Instantly share code, notes, and snippets.

@formigarafa
Last active April 29, 2016 14:03
Show Gist options
  • Save formigarafa/6076fb85651b79ab7addb463cdf3208d to your computer and use it in GitHub Desktop.
Save formigarafa/6076fb85651b79ab7addb463cdf3208d to your computer and use it in GitHub Desktop.
prax configuration with ssl via nginx. Note: remember to stop prax service (but not the daemon)
upstream prax_unsecure_backend {
server localhost:20559;
}
server {
listen 80;
server_name *.dev;
server_name *.xip.io;
server_name *.rafael.nz;
location / {
proxy_pass http://prax_unsecure_backend;
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;
}
}
upstream prax_secure_backend {
server localhost:20558;
}
server {
listen 443 default ssl;
server_name *.dev;
server_name *.xip.io;
server_name *.rafael.nz;
ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem;
ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;
location / {
proxy_pass https://prax_secure_backend;
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;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
# changed Prax::XIP_RE to also match *.rafael.nz domains
# file at lib/prax/request.rb
module Prax
# ...
#XIP_RE = /^(.*?)\.?\d+.\d+\.\d+\.\d+\.xip\.io$/
XIP_RE = /^(.*?)\.?((\d+.\d+\.\d+\.\d+\.xip\.io)|(rafael\.nz))$/
# ...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment