From b987effc8932ead4f66e5c4315f0f4a61741f4be Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Wed, 19 Apr 2017 00:00:48 +0200 Subject: [PATCH] Route .json and .png requests to Clojure app --- docker/nginx/asciinema.conf | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docker/nginx/asciinema.conf b/docker/nginx/asciinema.conf index 6e92331..2b8c371 100644 --- a/docker/nginx/asciinema.conf +++ b/docker/nginx/asciinema.conf @@ -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; + } }