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

[Bug]: 使用非80/443端口时,Waline无法注册用户 || [Bug]: Waline cannot register users when using non-80/443 ports #2603

Closed
asforest opened this issue Jul 9, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@asforest
Copy link
Contributor

asforest commented Jul 9, 2024

问题描述 | Describe the bug

我的Waline部署在Docker上,使用Sqlite作为数据库。但是我发现如果将waline部署在非80/443端口上时(通过docker配置文件暴露到非80/443端口),比如https://abc.com:9010时,正常的发频率没问题,但是登录注册这些功能全部用不了。

通过观察网络请求发现,请求全部发往了https://abc.com这个地址,后面的端口丢失了,后台也就进不去了。

这个问题从1.24版本开始就有了,当时只是注册邮件会丢失端口,登录和注册不受影响。最近升级到了1.32,直接连后台都进不去了。

这里附上我的docker文件

version: '3'

services:
  reverse-proxy:
    image: nginx:1.25-alpine
    container_name: waline-proxy
    restart: unless-stopped
    ports:
      - '9010:9010'
    volumes:
      - ./nginx/nginx.conf:/etc/nginx/nginx.conf
      - ./nginx:/data

  waline:
    image: lizheming/waline:1.32.0 # 1.24.1
    container_name: waline
    restart: unless-stopped
    volumes:
      - ./data:/app/data
    environment:
      TZ: 'Asia/Shanghai'
      SQLITE_PATH: '/app/data'
      AVATAR_PROXY: 'false'
      IPQPS: 30
      AKISMET_KEY: 'false'
      SENDER_EMAIL: [email protected]
      SITE_URL: https://xxxx.cn

还有nginx文件

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}

http {
    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/access.log  main;
    access_log /dev/stdout;
    error_log /dev/stderr;
    # access_log off;
    # error_log off;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  5;

    # gzip settings
    # gzip            on;
    # gzip_min_length 1000;
    # gzip_proxied    expired no-cache no-store private auth;
    # gzip_types      text/* application/xml image/* application/*;

    limit_req_zone  $binary_remote_addr zone=req_zone:1m rate=90r/m;
    
    server {
        listen 9010 ssl;
        http2 on;

        limit_req zone=req_zone burst=30000 nodelay;

        ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
        ssl_ciphers AES128-SHA:AES256-SHA:RC4-SHA:DES-CBC3-SHA:RC4-MD5;
        ssl_certificate        /data/xxx.com.pem;
        ssl_certificate_key    /data/xxx.com.key;
        ssl_session_cache   shared:SSL:10m;
        ssl_session_timeout 5m;

        location / {
            proxy_pass http://waline:8360;
            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-Proto $scheme;
            proxy_set_header REMOTE-HOST $remote_addr;
            add_header X-Cache $upstream_cache_status;
            # cache
            add_header Cache-Control no-cache;
            expires 12h;
        }
    }
}

问题网站 | Website URL

https://comment.aprilforest.cn:9010

服务部署在哪里? | Where your waline deploy?

Docker

数据存储在哪里?| Where your comment data store?

SQLite


Problem description | Describe the bug

My Waline is deployed on Docker and uses Sqlite as the database. But I found that if waline is deployed on a non-80/443 port (exposed to a non-80/443 port through the docker configuration file), such as https://abc.com:9010, the normal sending frequency is no problem, but the login All these functions cannot be used after registration.

By observing the network requests, we found that all requests were sent to the address https://abc.com. The subsequent ports were lost and the backend could not enter.

This problem has existed since version 1.24. At that time, only registering emails would lose the port, but login and registration were not affected. Recently upgraded to 1.32, I can't even enter the backend.

Attached here is my docker file

version: '3'

services:
  reverse-proxy:
    image: nginx:1.25-alpine
    container_name:waline-proxy
    restart: unless-stopped
    ports:
      - '9010:9010'
    volumes:
      - ./nginx/nginx.conf:/etc/nginx/nginx.conf
      - ./nginx:/data

  waline:
    image: lizheming/waline:1.32.0 # 1.24.1
    container_name:waline
    restart: unless-stopped
    volumes:
      - ./data:/app/data
    environment:
      TZ: 'Asia/Shanghai'
      SQLITE_PATH: '/app/data'
      AVATAR_PROXY: 'false'
      IPQPS: 30
      AKISMET_KEY: 'false'
      SENDER_EMAIL: [email protected]
      SITE_URL: https://xxxx.cn

There are also nginx files

#user nobody;
worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;


events {
    worker_connections 1024;
}

http {
    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/access.log main;
    access_log /dev/stdout;
    error_log /dev/stderr;
    # access_log off;
    # error_log off;

    sendfile on;
    #tcp_nopush on;

    keepalive_timeout 5;

    # gzip settings
    # gzip on;
    # gzip_min_length 1000;
    # gzip_proxied expired no-cache no-store private auth;
    # gzip_types text/* application/xml image/* application/*;

    limit_req_zone $binary_remote_addr zone=req_zone:1m rate=90r/m;
    
    server {
        listen 9010 ssl;
        http2 on;

        limit_req zone=req_zone burst=30000 nodelay;

        ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
        ssl_ciphers AES128-SHA:AES256-SHA:RC4-SHA:DES-CBC3-SHA:RC4-MD5;
        ssl_certificate /data/xxx.com.pem;
        ssl_certificate_key /data/xxx.com.key;
        ssl_session_cache shared:SSL:10m;
        ssl_session_timeout 5m;

        location/{
            proxy_pass http://waline:8360;
            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-Proto $scheme;
            proxy_set_header REMOTE-HOST $remote_addr;
            add_header X-Cache $upstream_cache_status;
            # cache
            add_header Cache-Control no-cache;
            expires 12h;
        }
    }
}

Question Website | Website URL

https://comment.aprilforest.cn:9010

Where is the service deployed? | Where your waline deploy?

Docker

Where is the data stored? | Where your comment data store?

SQLite

@asforest asforest added the bug Something isn't working label Jul 9, 2024
@github-actions github-actions bot changed the title [Bug]: 使用非80/443端口时,Waline无法注册用户 [Bug]: 使用非80/443端口时,Waline无法注册用户 || [Bug]: Waline cannot register users when using non-80/443 ports Jul 9, 2024
@lizheming
Copy link
Collaborator

lizheming commented Jul 9, 2024

SERVER_URL 设置这个环境变量为https://comment.aprilforest.cn:9010 试试。https://github.com/walinejs/waline/blob/main/packages/server/src/config/extend.js#L15-L19


SERVER_URL Set this environment variable to https://comment.aprilforest.cn:9010 and try it. https://github.com/walinejs/waline/blob/main/packages/server/src/config/extend.js#L15-L19

@asforest
Copy link
Contributor Author

asforest commented Jul 9, 2024

谢谢,这个方法有效果!


Thank you, this method works!

@asforest asforest closed this as completed Jul 9, 2024
@asforest
Copy link
Contributor Author

asforest commented Jul 9, 2024

如果可以的话,将这个环境变量添加到教程文档里面吗?


If possible, would you add this environment variable to the tutorial document?

@lizheming
Copy link
Collaborator

lizheming commented Jul 9, 2024

可以,欢迎 PR 呀


Yes, PR is welcome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants