【发布时间】:2021-12-28 21:07:08
【问题描述】:
嗨,我是Nginx 的绝对初学者!我在闪亮的服务器前使用 Nginx 作为反向代理,并认识到 Nginx 写入了两个文件 html 和 log。在access.log 我可以看到用户名。我的 Nginx 配置文件的重要部分包含这部分
http {
server_tokens off;
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/nginx_shiny_access.log;
sendfile on;
keepalive_timeout 65;
auth_ldap_cache_enabled on;
auth_ldap_cache_expiration_time 10000;
auth_ldap_cache_size 1000;
由于$remote_user,我可以看到logs/nginx_shiny_access.log中的用户名。
我如何获取html 文件中的用户名并且只是临时,因为我需要应用程序中的用户名但我不知道如何获取它们?
提前谢谢你。
【问题讨论】:
-
嗨,检查一下如何在 nginx 中转发自定义标头,serverfault.com/questions/391554/…,这将向您展示如何在闪亮的应用程序中访问它,stackoverflow.com/questions/42442936/…
-
这不是 nginx 工作。
$remote_usernginx 变量包含基本身份验证提供的用户名。它是一个后端 Web 应用程序,可以检查AuthorizationHTTP 标头值并在生成 HTML 文档时使用它。
标签: nginx shiny nginx-reverse-proxy shiny-server