Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

localhost可以正常登录,nginx反向代理后,用域名登陆后会再次跳转到登陆页面 #379

Open
qq253498229 opened this issue Apr 13, 2023 · 5 comments

Comments

@qq253498229
Copy link

xxxxx这里是问题描述xxxx

  1. 当前使用的版本号
    v0.2.1

  2. 是否已经升级到新版本

  3. 当前遇到的问题
    localhost可以正常登录,域名不行,域名是 https://wiki.codeforfun.cn
    内网使用localhost:8081登录一切都正常,如果是使用域名访问,访问后会显示登录界面,输入用户名密码也能显示登录成功,但是进里面页面就闪了一下就又退回到登录页面了。多次尝试都是同样的现象

  4. 错误日志或截图
    xxx

  5. 希望增加的功能
    能够正常访问

@qq253498229
Copy link
Author

ip访问也是同样的现象,提示登录成功,但是还是跳转到登录界面

@qq253498229 qq253498229 changed the title localhost可以正常登录,域名不行 localhost可以正常登录,nginx反向代理后,用域名登陆后会再次跳转到登陆页面 Feb 5, 2025
@qq253498229
Copy link
Author

目前仍然有这个问题,请问有人知道怎么解决吗?

@GX158
Copy link

GX158 commented Feb 5, 2025 via email

@qq253498229
Copy link
Author

这是目前的nginx.conf配置:

    server {
        listen       443 ssl;
        server_name  wiki.codeforfun.cn;
        ssl_certificate C:\\tools\\nginx-1.27.3\\cert\\wiki.codeforfun.cn_bundle.crt;
        ssl_certificate_key C:\\tools\\nginx-1.27.3\\cert\\wiki.codeforfun.cn.key;
        ssl_session_timeout 5m;
        ssl_protocols TLSv1.2 TLSv1.3;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
        ssl_prefer_server_ciphers on;
        # 静态资源交由nginx管理
        location /static {
            root C:\\tools\\mm-wiki\\mm-wiki-v0.2.1-windows-386;
            #root        /www/mm-wiki; # MM-Wiki 的根目录
            expires     1d;
            add_header  Cache-Control public;
            access_log  off;
        }
        #location / {
        #    proxy_pass_header Server;
        #    proxy_set_header Host $http_host;
        #    proxy_redirect off;
        #    proxy_set_header X-Real-IP $remote_addr;
        #    proxy_set_header X-Scheme $scheme;
        #    proxy_pass http://localhost:8091;
        #}
        location / {
          proxy_pass http://localhost:8091;
          proxy_set_header Host $host;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header X-Forwarded-Host $http_host;
          proxy_set_header X-Forwarded-Port $server_port;
          proxy_set_header X-Forwarded-Proto $scheme;
          #proxy_redirect off;
        }
    }

@qq253498229
Copy link
Author

qq253498229 commented Feb 5, 2025

暂时解决了,似乎是反向代理的问题。
之前是0.0.0.0,不知道出了什么问题这么配置不好使。
改成127.0.0.1之后好用了

# httpaddr mm-wiki 程序监听的 ip
# 0.0.0.0 是对外开放,通过服务域名、ip 可以访问的端口
# 127.0.0.1 只能对本机 localhost访问,可以保护此端口安全性
httpaddr = "127.0.0.1"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants