方法一 DNS + LocalIP

  1. 找到你的local ip, e.g. 192.168.0.17
ifconfig | grep '192'
  1. DNS A record 到 local ip, e.g. invoice.mvrater.com ⇒ local ip
  2. Certificate掛給local reverse proxy. e.g.
# docker-compose
version: "3.2"

services:
  entry:
    image: traefik:v2.6.3
    command:
    - --accesslog
    - --api.insecure
    - --entrypoints.web.address=:3001
    - --providers.file.directory=/config
    - --entrypoints.websecure.address=:443
    - --entrypoints.websecure.http.tls
    volumes:
    - ./entry-config:/config
    ports:
    - "3001:3001"
    - "443:443"

# traefik.yaml
http:
  routers:
    invoice-web:
      rule: "PathPrefix(`/`)"
      service: invoice-web

    parse-gql:
      rule: "PathPrefix(`/graphql`)"
      service: parse

    parse-rest:
      rule: "PathPrefix(`/api`)"
      service: parse
---
http:
  services:
    invoice-web:
      loadBalancer:
        servers:
        - url: <http://host.docker.internal:3000>

    parse:
      loadBalancer:
        passHostHeader: false
        servers:
        # - url: <http://url/to/parse/server>
        - url: <http://host.docker.internal:1337>
---
tls:
  stores:
    default:
      defaultCertificate:
        certFile: /config/mvrater.com/cert1.pem
        keyFile: /config/mvrater.com/privkey1.pem
  1. LIFF 後台 entrypoint 到DNS name
  2. 手機 real 的 line 可以直接連 DNS name
  3. BETA的話就要連vpn, 再用beta line才行連了

方法二 Charles proxy

  1. charles menu ⇒ proxy ⇒ macOS proxy

  2. Connect to same WIFI in your mobile & Mac

  3. Setup WIFI proxy on your mobile 可透過charles menu ⇒ help ⇒ local ip address取得

    IMG_4433.jpg

  4. 手機安裝certificate(iOS為例):

    1. 點擊下載憑證 chls.pro/ssl
    2. 設定 -> 一般 -> 描述檔與裝置管理 -> charles proxy -> 安裝
  5. Charles map hostname to local: Tools -> MapRemote -> 參照圖片設定

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/f4227cc8-962d-441b-bd51-75d1c1a261c2/messageImage_1607065938169.jpg

Andriod 安裝憑證參考