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

Optimize login form & fix nginx issue & fix oidc issue #2326

Closed
wants to merge 1 commit into from

Conversation

finovy
Copy link
Contributor

@finovy finovy commented Oct 12, 2023

优化了登录界面更美观

修复了登录界面存在横向滚动条的问题

配置项新增OIDC_BTN_NAME,支持定义OIDC登录的按钮名称

正式环境中配置了https入口,试图对接KeyCloak登录失败,mozilla_django_oidc\auth.py中redirect_uri读取了9123端口导致回调到了http入口,导致认证完成后无法跳转到https入口

修复由于X-Forwarded-Host $host:nginx_port;的配置,导致抛出错误:

[2023-10-12 13:07:52 +0800] [31] [ERROR] Error handling request /
Traceback (most recent call last):
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 56, in inner
response = get_response(request)
File "/opt/venv4archery/lib/python3.9/site-packages/django/utils/deprecation.py", line 135, in call
response = self.process_request(request)
File "/opt/venv4archery/lib/python3.9/site-packages/django/middleware/common.py", line 48, in process_request
host = request.get_host()
File "/opt/venv4archery/lib/python3.9/site-packages/django/http/request.py", line 152, in get_host
raise DisallowedHost(msg)
django.core.exceptions.DisallowedHost: Invalid HTTP_HOST header: 'archery-bl.internal-project.com:nginx_port'. The domain name provided is not valid according to RFC 1034/1035.

Copy link
Collaborator

@LeoQuote LeoQuote left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不接受这几个关于 nginx 的修改, docker-compose 和 docker 打出来的镜像就是只暴露 http 协议的, 后续再用其他的反向代理再加 https 支持

@finovy
Copy link
Contributor Author

finovy commented Oct 12, 2023

如果使用其他反向代理,那么这个问题无法解决哦:

mozilla_django_oidc\auth.py中redirect_uri读取了9123端口导致回调到了http入口

@codecov
Copy link

codecov bot commented Oct 12, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (d4b5ea9) 75.50% compared to head (1c0d436) 75.50%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2326   +/-   ##
=======================================
  Coverage   75.50%   75.50%           
=======================================
  Files         107      107           
  Lines       15460    15460           
=======================================
  Hits        11673    11673           
  Misses       3787     3787           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@LeoQuote
Copy link
Collaborator

我这边用的就是反向代理, 都很正常, 这个原理是反向代理携带了正确的 X-Forward-For header, django_oidc 可以正常识别到这个 header, 你可以在这个方向检查一下

@finovy
Copy link
Contributor Author

finovy commented Oct 12, 2023

好的,那我回滚这个PR

@finovy finovy closed this Oct 12, 2023
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

Successfully merging this pull request may close these issues.

2 participants