playframework - Reverse proxy for a subdirectory with nginx and Play 2.1 apps -
goal
setup multiple play 2.1 applications nginx using different subdirectory each application.
app1 running on 127.0.0.1:4000 should accessible under 127.0.0.1/dev
app2 running on 127.0.0.1:5000 should accessible under 127.0.0.1/test
configuration
nginx.conf
worker_processes 1; error_log logs/error.log; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; upstream app1 { server 127.0.0.1:4000; } upstream app2 { server 127.0.0.1:5000; } server { listen 80; server_name localhost; location /dev { rewrite /(.*) /$1 break; proxy_pass http://app1; } location /test { rewrite /(.*) /$1 break; proxy_pass http://app2; } } } app1 - application.conf
application.context=/dev app2 - application.conf
application.context=/test problem
with configuration can access both applications, html code loaded. static files (css, js, images) aren't loaded.
i think caching problem. i've tried different nginx parameters, without luck. if request site first time browser responds (for css , js files, e.g. 127.0.0.1/dev/assets/stylesheets/main.css) status 200 without content - content-length: 0. next time responds 304, still without content.
i'm not sure if nginx or play 2.1 configuration problem.
i appreciate help.
use local domains http://test.loc/ , http://dev.loc instead of relying on subfolders. although application.context should work saw many posts complaining don't...
what's more using local domains more similar final - production enviroment, it's easier debug url depended things, ie. cookies.
Comments
Post a Comment