---
# System prepended metadata

title: HackMD-ee SSL 問題

---

# HackMD-ee SSL 問題

## POST /me 502

![](https://i.imgur.com/A4309ei.png)

當修改使用者名稱時，儲存會出現以下錯誤

```
Request URL: https://hackmd.mores-dev.com/me
Request Method: POST
Status Code: 502 
```

### Payload
![](https://i.imgur.com/cVhgjEH.png)

### Response
![](https://i.imgur.com/Z62C33Y.png)

目前此帳號是透過 Google OAuth 註冊進入，設定為 SuperUser，尚未設定密碼

---

:::spoiler 封存已解決

## Chrome screenshot
> https://hackmd.mores-dev.com/

![](https://i.imgur.com/XzLjwyp.png)

## Chrome console
![](https://i.imgur.com/fvcwjMn.png)

## docker-compose.yml
```yaml=
version: "3"
services:
  database:
    image: postgres:11.11-alpine
    restart: unless-stopped
    volumes:
      - database:/var/lib/postgresql/data
    environment:
      - POSTGRES_USER=hackmd
      - POSTGRES_PASSWORD=databasePassword
      - POSTGRES_DB=hackmd

  cache:
    image: redis:5.0.12
    restart: unless-stopped

  hackmd:
    image: registry.hackmd.dev/mores/hackmd-ee:1.25.8
    restart: unless-stopped
    ports:
      - "3000:3000"
    volumes:
      - image:/home/hackmd/app/public/uploads
    environment:
      - HMD_DB_URL=postgres://hackmd:databasePassword@database:5432/hackmd
      - HMD_REDIS_URL=redis://cache:6379

      - HMD_DOMAIN=hackmd.mores-dev.com
      #- HMD_URL_ADDPORT=true
      - HMD_ENFORCE_SSL=true
      - HMD_IMAGE_UPLOAD_TYPE=filesystem
      - HMD_CAN_CREATE_TEAM=true
      - HMD_COMMENTS=true
      - HMD_DEFAULT_ROLE=BasicUser
      - HMD_FULL_TEXT_SEARCH_ENABLE=true

volumes:
  database: {}
  image: {}
```

## nginx 
```nginx=
upstream @hackmd {
    server hackmd.mores-dev.com:3000;
    keepalive 300;
}

map $http_upgrade $connection_upgrade {
    default upgrade;
    ''      close;
}

server {
    listen 80;
    server_name hackmd.mores-dev.com;
    return 301 https://$server_name$request_uri;
}

server {
    listen 443 ssl http2;
    server_name hackmd.mores-dev.com;

    ssl_certificate /etc/ssl/letsencrypt/mores-dev.com.crt;
    ssl_certificate_key /etc/ssl/letsencrypt/mores-dev.com.key;

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    location / {
      proxy_http_version 1.1;
      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 Upgrade $http_upgrade;
      proxy_set_header Connection $connection_upgrade;
      client_max_body_size 8192m;
      proxy_max_temp_file_size 8192m;

      # adjust proxy buffer setting
      proxy_buffers 8 32k;
      proxy_buffer_size 32k;
      proxy_busy_buffers_size 64k;

      proxy_read_timeout 300;
      proxy_connect_timeout 300;
      proxy_pass http://@hackmd;
    }
}
```

## Answer
```yaml=
HMD_PROTOCOL_USESSL=true
```

:::

