I'm working with a strangely architected app and I have a need to proxy / and redirect it to a sub-directory (unless someone can comeup with a better solution). Here's the layout of the paths the app uses:
var securePaths = [
"/someaction",
"/anotheraction",
"/athirdaction",
"/client/interfaceishere/index.html" //path to client interface
];
As you can see the place where the client interfaces with the app is two levels in so I need a redirect to there. I can't proxy the app there because it needs access to top level paths like "/someaction". I have nginx configured to the proxy the app like this:
upstream socket_nodes {
ip_hash;
server 127.0.0.1:8080;
}
server {
server_name myapp.example.com;
listen 80;
location / {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:8080;
}
}
What's the best way to get the user down to "/client/interfaceishere/index.html"?
The previous users of this app solved this by iframing which is not an option for me.
答案 0 :(得分:0)
然后你需要将它拆分,位置块内的路径而不是用/传递所有内容。您首先需要思考并记下每个路径需要去的位置,然后使用“map”重定向或/和位置块来处理事物。您可以使用位置块分别处理每个uri。