Trying to let the url rewriting work in conjuction with the port forwarding but it seems doesn't work.
My application server is run at :8080
port while the nginx
works at default 80
one. So I'm forced not only to rewrite the urls but also forward the request to another port.
Actually, the only I'm trying to do is query the existing resource http://localhost:8080/#/cat/tom
by it's shortcut http://localhost/tom
without any redirect.
Here's what I made based on nginx
doc and other questions:
server { listen 80; server_name localhost; root /; #charset koi8-r; #access_log logs/host.access.log main; location / { rewrite ^/([a-z]+)$ /#/cat/$1 break; proxy_pass http://localhost:8080; proxy_redirect off; } ... }
Have tried another configurations but neither does work. When I access the http://localhost/tom
it says 404 not found
while the http://localhost:8080/#/cat/tom
works as expected.
Logs are haven't any error mention.
How to force this work as expected?