我在磁盘上的文件有扩展名:index.html, a.html. 我想要一个http://example.com/a加载/var/www/a.html和http://example.com/加载的请求/var/www/index.html.我希望任何其他网址重定向到规范网址,因此http://example.com/a.html应重定向到http://example.com/a.
我的配置如下:
rewrite ^(/.+)\.html$ $scheme://$host$1 permanent;
location / {
root /var/www;
try_files $uri.html $uri $uri/ =404;
}
Run Code Online (Sandbox Code Playgroud)
这不重定向/a.html到/a在装载成功a.html从磁盘:
$ curl -D- -s http://www.jefftk.com/food.html | grep ^Location
Location: http://www.jefftk.com/food
$ curl -s http://www.jefftk.com/food | grep ^Location
Run Code Online (Sandbox Code Playgroud)
但它发送/给/index:
$ curl -s -D- http://www.jefftk.com/pictures/ | grep ^Location
Location: http://www.jefftk.com/pictures/index
$ curl -s -D- http://www.jefftk.com | grep …Run Code Online (Sandbox Code Playgroud) 我正在制作一个纯粹的客户端网络应用程序,它显示用户 Google 日历中的一些信息。他们通过 OAuth,授予日历访问权限,然后查看派生信息。按照Google Calendar JS 快速入门,我基本上可以正常工作了。
问题是,访问令牌的有效期仅为 1 小时(3599 秒)。之后,我需要再次让用户完成整个 OAuth 流程以获取新令牌,这需要在三个屏幕上单击四次。有什么办法可以避免每次都需要征求新的同意吗?