Route .json and .png requests to Clojure app

This commit is contained in:
Marcin Kulik 2017-04-19 00:00:48 +02:00
parent 3e2bb2682e
commit b987effc89

View File

@ -2,6 +2,10 @@ upstream rails-server {
server 127.0.0.1:3000 fail_timeout=0;
}
upstream clj-server {
server 127.0.0.1:4000 fail_timeout=0;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
@ -12,6 +16,10 @@ server {
client_max_body_size 16m;
location ~ ^/a/[^.]+\.(json|png)$ {
try_files $uri $uri/index.html $uri.html @clj;
}
location / {
try_files $uri $uri/index.html $uri.html @rails;
}
@ -33,4 +41,13 @@ server {
proxy_redirect off;
error_page 500 502 504 /500.html; # Rails error pages
}
location @clj {
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;
proxy_set_header Host $http_host;
proxy_pass http://clj-server;
proxy_redirect off;
}
}