我想重定向用户从我的webapp(myserver.com)到Tableau服务器托管在tabserver.com
每当我在浏览器中点击tabserver.com的登录URL时,URL栏显示如下:tabserver.com/signin或tabserver.com/signin?redirect=someURL
同样,当我从tableau服务器注销时,URL栏总是显示如下:tabserver.com/signin?disableAutoSignin=yes
所以登录和注销URL都指向/signin,只是URL参数改变了。
nginx配置是否可以这样配置:
- 点击tabserver.com/#/site/,它将我重定向到myserver.com?
- 当注销时,它也重定向到myserver.com?
If you are using NGINX’s main configuration file nginx.conf
without virtual hosts.
Sudo vi /etc/nginx/nginx.conf
(Sudo is for Linux systems)
configure separate virtual hosts for your website (e.g www.myweb.com), such as /etc/nginx/sites-enabled/myweb.conf
然后用下面的命令打开它。
/etc/nginx/sites-enabled/mysite.conf
(Linux系统使用Sudo)
例如,如果你想重定向/登录到新域(www.myserver.com),然后添加以下位置块
server{
location /login {
rewrite ^/login(.*)$ https://www.myserver.com/$1 redirect;
}
}
rewrite – rewrite command tells NGINX to change one or more
URLs that match a given pattern (e.g /login) to another URL.
^/login – URL paths that start with /login. You can change it to
another URL as you need it.
(.*) – match one or more characters. In our case, it means
anything that follows /login.
$ – end of string
$1 - URL part after /login