caddyserver / caddy

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
https://caddyserver.com
Apache License 2.0
58.36k stars 4.04k forks source link

caddy does not support outlook 2013 client #6679

Closed nonbutAworker closed 6 days ago

nonbutAworker commented 6 days ago

Hi team: I have met a strange issue that has stuck me for days. any help would be appreciated !

When I use nginx as reverse proxy between outlook 2013 and exchnage server cu14, new account can be added normally, and logged account can receive mail normally. This is my nginx config:

# nginx version: nginx/1.27.2
server {
    listen       443 ssl;
    server_name  mail.chouyulanxia.com;
    ssl_certificate /opt/feilian/agw/conf/cert/3_mail.chouyulanxia.com.crt;
    ssl_certificate_key /opt/feilian/agw/conf/cert/3_mail.chouyulanxia.com.key;

    location / {
        proxy_pass https://bricking.com.cn;
        proxy_set_header Host $host;
        proxy_buffering off; # if remove this, outlook 2013 will occur an error immediately
    }
}

When I user caddy as my reverse proxy between outlook 2013 and exchange server cu14, new account can NOT be added normally, and logged account can NOT receive mail normally. This is my caddy config:

# caddy version: v2.8.4 h1:q3pe0wpBj1OcHFZ3n/1nl4V4bxBrYoSoab7rL9BMYNk=
{
    debug
}

mail.chouyulanxia.com:443 {
    tls /opt/feilian/agw/conf/cert/3_mail.chouyulanxia.com.crt /opt/feilian/agw/conf/cert/3_mail.chouyulanxia.com.key
    reverse_proxy https://bricking.com.cn {

        transport http {
                tls
                tls_insecure_skip_verify
        }
        header_up Host {host}
    }
}

This is outlook 2013 error message: Image

francislavoie commented 6 days ago

Thanks for opening an issue! We'll look into this.

It's not immediately clear to us what is going on, so we'll need your help to understand it better.

Ideally, we need to be able to reproduce the bug in the most minimal way possible. This allows us to write regression tests to verify the fix is working. If we can't reproduce it, then you'll have to test our changes for us until it's fixed -- and then we can't add test cases, either.

I've attached a template below that will help make this easier and faster! It will ask for some information you've already provided; that's OK, just fill it out the best you can. :+1:

I've also included some helpful tips below the template. Feel free to let me know if you have any questions!

Thank you again for your report, we look forward to resolving it!

Template

## 1. Environment

### 1a. Operating system and version

```
paste here
```

### 1b. Caddy version (run `caddy version` or paste commit SHA)

```
paste here
```

### 1c. Go version (if building Caddy from source; run `go version`)

```
paste here
```

## 2. Description

### 2a. What happens (briefly explain what is wrong)

### 2b. Why it's a bug (if it's not obvious)

### 2c. Log output

```
paste terminal output or logs here
```

### 2d. Workaround(s)

### 2e. Relevant links

## 3. Tutorial (minimal steps to reproduce the bug)

Helpful tips

  1. Environment: Please fill out your OS and Caddy versions, even if you don't think they are relevant. (They are always relevant.) If you built Caddy from source, provide the commit SHA and specify your exact Go version.

  2. Description: Describe at a high level what the bug is. What happens? Why is it a bug? Not all bugs are obvious, so convince readers that it's actually a bug.

    • 2c) Log output: Paste terminal output and/or complete logs in a code block. DO NOT REDACT INFORMATION except for credentials.
    • 2d) Workaround: What are you doing to work around the problem in the meantime? This can help others who encounter the same problem, until we implement a fix.
    • 2e) Relevant links: Please link to any related issues, pull requests, docs, and/or discussion. This can add crucial context to your report.
  3. Tutorial: What are the minimum required specific steps someone needs to take in order to experience the same bug? Your goal here is to make sure that anyone else can have the same experience with the bug as you do. You are writing a tutorial, so make sure to carry it out yourself before posting it. Please:

    • Start with an empty config. Add only the lines/parameters that are absolutely required to reproduce the bug.
    • Do not run Caddy inside containers.
    • Run Caddy manually in your terminal; do not use systemd or other init systems.
    • If making HTTP requests, avoid web browsers. Use a simpler HTTP client instead, like curl.
    • Do not redact any information from your config (except credentials). Domain names are public knowledge and often necessary for quick resolution of an issue!
    • Note that ignoring this advice may result in delays, or even in your issue being closed. 😞 Only actionable issues are kept open, and if there is not enough information or clarity to reproduce the bug, then the report is not actionable.

Example of a tutorial:

Create a config file: ``` { ... } ``` Open terminal and run Caddy: ``` $ caddy ... ``` Make an HTTP request: ``` $ curl ... ``` Notice that the result is ___ but it should be ___.
nonbutAworker commented 6 days ago

1. Environment

1a. Operating system and version

   Static hostname: VM-32-4-opencloudos
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 53c964ec95f34cce99757c9bd19e5422
           Boot ID: 820fcf2ca64742a59d277036a3bdeef0
    Virtualization: kvm
  Operating System: OpenCloudOS 8.8
       CPE OS Name: cpe:/o:opencloudos:opencloudos:8
            Kernel: Linux 5.4.119-20.0009.32
      Architecture: x86-64

1b. Caddy version (run caddy version or paste commit SHA)

v2.8.4 h1:q3pe0wpBj1OcHFZ3n/1nl4V4bxBrYoSoab7rL9BMYNk=

1c. Go version (if building Caddy from source; run go version)

go version go1.22.5 linux/amd64

2. Description

2a. What happens (briefly explain what is wrong)

I change my reverse proxy from nginx to caddy, and my outlook 2013 client occured errors, new account can NOT be added normally, and logged account can NOT receive mail normally Image

2b. Why it's a bug (if it's not obvious)

because if I use nginx as a reverse proxy, everything is fine, and if I connect to exchange server directly, everything is fine too

2c. Log output

2024/11/07 12:11:27.950 DEBUG   events  event   {"name": "tls_get_certificate", "id": "7bbf14ff-0245-48c8-aa03-e72ca7e7b4c2", "origin": "tls", "data": {"client_hello":{"CipherSuites":[4866,4865,49196,49195,49200,49199,49188,49187,49192,49191,49162,49161,49172,49171,157,156,61,60,53,47],"ServerName":"chouyulanxia.com","SupportedCurves":[29,23,24],"SupportedPoints":null,"SignatureSchemes":[2052,2053,2054,1025,1281,513,1027,1283,515,514,1537,1539],"SupportedProtos":null,"SupportedVersions":[772,771],"RemoteAddr":{"IP":"114.251.196.106","Port":54659,"Zone":""},"LocalAddr":{"IP":"172.21.32.4","Port":443,"Zone":""}}}}
2024/11/07 12:11:27.950 DEBUG   tls.handshake   no matching certificates and no custom selection logic  {"identifier": "chouyulanxia.com"}
2024/11/07 12:11:27.950 DEBUG   tls.handshake   no matching certificates and no custom selection logic  {"identifier": "*.com"}
2024/11/07 12:11:27.950 DEBUG   tls.handshake   no matching certificates and no custom selection logic  {"identifier": "*.*"}
2024/11/07 12:11:27.950 DEBUG   tls.handshake   no certificate matching TLS ClientHello {"remote_ip": "114.251.196.106", "remote_port": "54659", "server_name": "chouyulanxia.com", "remote": "114.251.196.106:54659", "identifier": "chouyulanxia.com", "cipher_suites": [4866, 4865, 49196, 49195, 49200, 49199, 49188, 49187, 49192, 49191, 49162, 49161, 49172, 49171, 157, 156, 61, 60, 53, 47], "cert_cache_fill": 0.0001, "load_or_obtain_if_necessary": true, "on_demand": false}
2024/11/07 12:11:27.950 DEBUG   http.stdlib http: TLS handshake error from 114.251.196.106:54659: no certificate available for 'chouyulanxia.com'
2024/11/07 12:11:28.084 DEBUG   events  event   {"name": "tls_get_certificate", "id": "3f3eecd8-e759-47d2-9e8c-b9edd0e573aa", "origin": "tls", "data": {"client_hello":{"CipherSuites":[4866,4865,49196,49195,49200,49199,49188,49187,49192,49191,49162,49161,49172,49171,157,156,61,60,53,47],"ServerName":"mail.chouyulanxia.com","SupportedCurves":[29,23,24],"SupportedPoints":null,"SignatureSchemes":[2052,2053,2054,1025,1281,513,1027,1283,515,514,1537,1539],"SupportedProtos":null,"SupportedVersions":[772,771],"RemoteAddr":{"IP":"114.251.196.88","Port":54673,"Zone":""},"LocalAddr":{"IP":"172.21.32.4","Port":443,"Zone":""}}}}
2024/11/07 12:11:28.084 DEBUG   tls.handshake   choosing certificate    {"identifier": "mail.chouyulanxia.com", "num_choices": 1}
2024/11/07 12:11:28.084 DEBUG   tls.handshake   custom certificate selection results    {"identifier": "mail.chouyulanxia.com", "subjects": ["mail.chouyulanxia.com"], "managed": false, "issuer_key": "", "hash": "8aebf90ffe3e3262a35769b369a45f78f38f71de3b18f6c5a0cf0db86b07de20"}
2024/11/07 12:11:28.084 DEBUG   tls.handshake   matched certificate in cache    {"remote_ip": "114.251.196.88", "remote_port": "54673", "subjects": ["mail.chouyulanxia.com"], "managed": false, "expiration": "2025/01/19 00:00:00.000", "hash": "8aebf90ffe3e3262a35769b369a45f78f38f71de3b18f6c5a0cf0db86b07de20"}
2024/11/07 12:11:28.102 DEBUG   http.handlers.reverse_proxy selected upstream   {"dial": "bricking.com.cn:443", "total_upstreams": 1}
2024/11/07 12:11:28.128 DEBUG   http.handlers.reverse_proxy upstream roundtrip  {"upstream": "bricking.com.cn:443", "duration": 0.025758617, "request": {"remote_ip": "114.251.196.88", "remote_port": "54673", "client_ip": "114.251.196.88", "proto": "HTTP/1.1", "method": "OPTIONS", "host": "mail.chouyulanxia.com", "uri": "/Microsoft-Server-ActiveSync", "headers": {"Authorization": ["REDACTED"], "X-Forwarded-Proto": ["https"], "X-Forwarded-Host": ["mail.chouyulanxia.com"], "X-Forwarded-For": ["114.251.196.88"], "User-Agent": ["Outlook/15.0 (15.0.4569.1505; MSI; x64)"], "X-Ms-Wl": ["Outlook/1.0"], "X-Transactionid": ["{CC83D3E9-08AB-42C6-97E4-E1EADAECAA58}"]}, "tls": {"resumed": false, "version": 772, "cipher_suite": 4865, "proto": "", "server_name": "mail.chouyulanxia.com"}}, "headers": {"Cache-Control": ["private"], "Allow": ["OPTIONS,POST"], "X-Diaginfo": ["EXCHANGE"], "X-Beserver": ["EXCHANGE"], "Set-Cookie": ["REDACTED"], "Content-Type": ["application/vnd.ms-sync.wbxml"], "Server": ["Microsoft-IIS/10.0"], "Ms-Server-Activesync": ["15.2"], "Ms-Asprotocolcommands": ["Sync,SendMail,SmartForward,SmartReply,GetAttachment,GetHierarchy,CreateCollection,DeleteCollection,MoveCollection,FolderSync,FolderCreate,FolderDelete,FolderUpdate,MoveItems,GetItemEstimate,MeetingResponse,Search,Settings,Ping,ItemOperations,Provision,ResolveRecipients,ValidateCert,Find"], "X-Aspnet-Version": ["4.0.30319"], "X-Powered-By": ["ASP.NET"], "Date": ["Thu, 07 Nov 2024 12:11:28 GMT"], "Content-Length": ["0"], "Request-Id": ["b77d77df-d9a3-47d3-a331-5fa018ae4a5d"], "X-Calculatedbetarget": ["exchange.chouyulanxia.com"], "Ms-Asprotocolversions": ["2.0,2.1,2.5,12.0,12.1,14.0,14.1,16.0,16.1"], "Public": ["OPTIONS,POST"], "X-Ms-Backoffduration": ["L/-470"], "X-Feserver": ["EXCHANGE"]}, "status": 200}
2024/11/07 12:11:28.327 DEBUG   http.stdlib http: TLS handshake error from 120.46.22.78:42605: EOF
2024/11/07 12:11:28.687 DEBUG   http.stdlib http: TLS handshake error from 120.46.22.78:24179: EOF
2024/11/07 12:11:28.841 DEBUG   http.stdlib http: TLS handshake error from 120.46.22.78:54703: EOF
2024/11/07 12:11:29.249 DEBUG   events  event   {"name": "tls_get_certificate", "id": "3cdf60df-8975-45a1-938d-23eed9f291e7", "origin": "tls", "data": {"client_hello":{"CipherSuites":[4866,4865,49196,49195,49200,49199,49188,49187,49192,49191,49162,49161,49172,49171,157,156,61,60,53,47],"ServerName":"mail.chouyulanxia.com","SupportedCurves":[29,23,24],"SupportedPoints":null,"SignatureSchemes":[2052,2053,2054,1025,1281,513,1027,1283,515,514,1537,1539],"SupportedProtos":null,"SupportedVersions":[772,771],"RemoteAddr":{"IP":"114.251.196.92","Port":54674,"Zone":""},"LocalAddr":{"IP":"172.21.32.4","Port":443,"Zone":""}}}}
2024/11/07 12:11:29.249 DEBUG   tls.handshake   choosing certificate    {"identifier": "mail.chouyulanxia.com", "num_choices": 1}
2024/11/07 12:11:29.249 DEBUG   tls.handshake   custom certificate selection results    {"identifier": "mail.chouyulanxia.com", "subjects": ["mail.chouyulanxia.com"], "managed": false, "issuer_key": "", "hash": "8aebf90ffe3e3262a35769b369a45f78f38f71de3b18f6c5a0cf0db86b07de20"}
2024/11/07 12:11:29.249 DEBUG   tls.handshake   matched certificate in cache    {"remote_ip": "114.251.196.92", "remote_port": "54674", "subjects": ["mail.chouyulanxia.com"], "managed": false, "expiration": "2025/01/19 00:00:00.000", "hash": "8aebf90ffe3e3262a35769b369a45f78f38f71de3b18f6c5a0cf0db86b07de20"}
2024/11/07 12:11:29.262 DEBUG   http.handlers.reverse_proxy selected upstream   {"dial": "bricking.com.cn:443", "total_upstreams": 1}
2024/11/07 12:11:29.272 DEBUG   http.handlers.reverse_proxy upstream roundtrip  {"upstream": "bricking.com.cn:443", "duration": 0.009378868, "request": {"remote_ip": "114.251.196.92", "remote_port": "54674", "client_ip": "114.251.196.92", "proto": "HTTP/1.1", "method": "POST", "host": "mail.chouyulanxia.com", "uri": "/mapi/nspi/?MailboxId=d8fb7e54-ecf9-4898-9fbb-3504d7bd8119@chouyulanxia.com", "headers": {"X-Forwarded-For": ["114.251.196.92"], "X-Clientapplication": ["Outlook/15.0.4569.1503"], "X-Requestid": ["{0BB3922E-ED62-4B67-9DFF-867F72312EBB}:1"], "Pragma": ["no-cache"], "X-Clientinfo": ["{9227A6D5-B1E3-45F9-BEE1-8B0837D3759D}:117"], "X-Forwarded-Host": ["mail.chouyulanxia.com"], "X-Requesttype": ["Bind"], "Content-Length": ["45"], "Accept": ["application/mapi-http"], "X-Forwarded-Proto": ["https"], "Content-Type": ["application/mapi-http"], "User-Agent": ["Microsoft Office/15.0 (Windows NT 6.2; Microsoft Outlook 15.0.4569; Pro)"], "Cache-Control": ["no-cache"]}, "tls": {"resumed": false, "version": 772, "cipher_suite": 4865, "proto": "", "server_name": "mail.chouyulanxia.com"}}, "headers": {"Content-Length": ["0"], "Server": ["Microsoft-IIS/10.0"], "Request-Id": ["a07cd5cb-9c37-4f35-bb69-c2aa7753c46c"], "X-Owa-Version": ["15.2.1544.4"], "Www-Authenticate": ["Basic realm=\"mail.chouyulanxia.com\""], "X-Powered-By": ["ASP.NET"], "X-Feserver": ["EXCHANGE"], "Date": ["Thu, 07 Nov 2024 12:11:29 GMT"]}, "status": 401}
2024/11/07 12:11:29.298 DEBUG   http.handlers.reverse_proxy selected upstream   {"dial": "bricking.com.cn:443", "total_upstreams": 1}
2024/11/07 12:11:29.327 DEBUG   http.handlers.reverse_proxy upstream roundtrip  {"upstream": "bricking.com.cn:443", "duration": 0.028967199, "request": {"remote_ip": "114.251.196.92", "remote_port": "54674", "client_ip": "114.251.196.92", "proto": "HTTP/1.1", "method": "POST", "host": "mail.chouyulanxia.com", "uri": "/mapi/nspi/?MailboxId=d8fb7e54-ecf9-4898-9fbb-3504d7bd8119@chouyulanxia.com", "headers": {"Pragma": ["no-cache"], "X-Forwarded-Proto": ["https"], "X-Forwarded-For": ["114.251.196.92"], "X-Requesttype": ["Bind"], "X-Forwarded-Host": ["mail.chouyulanxia.com"], "X-Clientapplication": ["Outlook/15.0.4569.1503"], "Authorization": ["REDACTED"], "X-Clientinfo": ["{9227A6D5-B1E3-45F9-BEE1-8B0837D3759D}:117"], "Accept": ["application/mapi-http"], "X-Requestid": ["{0BB3922E-ED62-4B67-9DFF-867F72312EBB}:2"], "Content-Type": ["application/mapi-http"], "User-Agent": ["Microsoft Office/15.0 (Windows NT 6.2; Microsoft Outlook 15.0.4569; Pro)"], "Cache-Control": ["no-cache"], "Content-Length": ["45"]}, "tls": {"resumed": false, "version": 772, "cipher_suite": 4865, "proto": "", "server_name": "mail.chouyulanxia.com"}}, "headers": {"Content-Type": ["application/mapi-http"], "X-Serverapplication": ["Exchange/15.02.1544.004"], "Set-Cookie": ["REDACTED"], "X-Powered-By": ["ASP.NET"], "Date": ["Thu, 07 Nov 2024 12:11:29 GMT"], "Vary": ["Accept-Encoding"], "X-Calculatedbetarget": ["exchange.chouyulanxia.com"], "X-Clientinfo": ["{9227A6D5-B1E3-45F9-BEE1-8B0837D3759D}:117"], "X-Requesttype": ["Bind"], "X-Tunnelexpirationtime": ["1800000"], "Cache-Control": ["private"], "X-Requestid": ["{0BB3922E-ED62-4B67-9DFF-867F72312EBB}:2"], "X-Pendingperiod": ["30000"], "X-Aspnet-Version": ["4.0.30319"], "X-Feserver": ["EXCHANGE"], "Server": ["Microsoft-IIS/10.0"], "Request-Id": ["c66401d9-82ce-4123-b138-d31d129b2c73"], "X-Expirationinfo": ["300000"], "X-Responsecode": ["0"], "X-Diaginfo": ["EXCHANGE"], "X-Beserver": ["EXCHANGE"]}, "status": 200}
2024/11/07 12:11:29.366 DEBUG   events  event   {"name": "tls_get_certificate", "id": "676b530c-6dd1-4ef1-8d48-3f492e674bfb", "origin": "tls", "data": {"client_hello":{"CipherSuites":[4866,4865,49196,49195,49200,49199,49188,49187,49192,49191,49162,49161,49172,49171,157,156,61,60,53,47],"ServerName":"mail.chouyulanxia.com","SupportedCurves":[29,23,24],"SupportedPoints":null,"SignatureSchemes":[2052,2053,2054,1025,1281,513,1027,1283,515,514,1537,1539],"SupportedProtos":null,"SupportedVersions":[772,771],"RemoteAddr":{"IP":"114.251.196.86","Port":54675,"Zone":""},"LocalAddr":{"IP":"172.21.32.4","Port":443,"Zone":""}}}}
2024/11/07 12:11:29.366 DEBUG   tls.handshake   choosing certificate    {"identifier": "mail.chouyulanxia.com", "num_choices": 1}
2024/11/07 12:11:29.366 DEBUG   tls.handshake   custom certificate selection results    {"identifier": "mail.chouyulanxia.com", "subjects": ["mail.chouyulanxia.com"], "managed": false, "issuer_key": "", "hash": "8aebf90ffe3e3262a35769b369a45f78f38f71de3b18f6c5a0cf0db86b07de20"}
2024/11/07 12:11:29.366 DEBUG   tls.handshake   matched certificate in cache    {"remote_ip": "114.251.196.86", "remote_port": "54675", "subjects": ["mail.chouyulanxia.com"], "managed": false, "expiration": "2025/01/19 00:00:00.000", "hash": "8aebf90ffe3e3262a35769b369a45f78f38f71de3b18f6c5a0cf0db86b07de20"}
2024/11/07 12:11:29.377 DEBUG   http.handlers.reverse_proxy selected upstream   {"dial": "bricking.com.cn:443", "total_upstreams": 1}
2024/11/07 12:11:29.405 DEBUG   http.handlers.reverse_proxy upstream roundtrip  {"upstream": "bricking.com.cn:443", "duration": 0.028085018, "request": {"remote_ip": "114.251.196.86", "remote_port": "54675", "client_ip": "114.251.196.86", "proto": "HTTP/1.1", "method": "POST", "host": "mail.chouyulanxia.com", "uri": "/mapi/nspi/?MailboxId=d8fb7e54-ecf9-4898-9fbb-3504d7bd8119@chouyulanxia.com", "headers": {"Accept": ["application/mapi-http"], "User-Agent": ["Microsoft Office/15.0 (Windows NT 6.2; Microsoft Outlook 15.0.4569; Pro)"], "Content-Length": ["45"], "X-Clientinfo": ["{9227A6D5-B1E3-45F9-BEE1-8B0837D3759D}:117"], "X-Requestid": ["{4A70D028-6DF2-4D92-A34C-714D09F1A4DF}:1"], "X-Forwarded-Host": ["mail.chouyulanxia.com"], "Authorization": ["REDACTED"], "Cache-Control": ["no-cache"], "X-Forwarded-For": ["114.251.196.86"], "X-Requesttype": ["Bind"], "X-Clientapplication": ["Outlook/15.0.4569.1503"], "Pragma": ["no-cache"], "X-Forwarded-Proto": ["https"], "Content-Type": ["application/mapi-http"]}, "tls": {"resumed": false, "version": 772, "cipher_suite": 4865, "proto": "", "server_name": "mail.chouyulanxia.com"}}, "headers": {"Server": ["Microsoft-IIS/10.0"], "X-Tunnelexpirationtime": ["1800000"], "X-Responsecode": ["0"], "X-Aspnet-Version": ["4.0.30319"], "Set-Cookie": ["REDACTED"], "X-Powered-By": ["ASP.NET"], "X-Calculatedbetarget": ["exchange.chouyulanxia.com"], "X-Pendingperiod": ["30000"], "X-Beserver": ["EXCHANGE"], "Cache-Control": ["private"], "X-Serverapplication": ["Exchange/15.02.1544.004"], "X-Clientinfo": ["{9227A6D5-B1E3-45F9-BEE1-8B0837D3759D}:117"], "X-Requesttype": ["Bind"], "X-Expirationinfo": ["300000"], "X-Diaginfo": ["EXCHANGE"], "X-Feserver": ["EXCHANGE"], "Date": ["Thu, 07 Nov 2024 12:11:29 GMT"], "Content-Type": ["application/mapi-http"], "Vary": ["Accept-Encoding"], "Request-Id": ["5101c9dc-b7a9-415e-a57e-306216ede9b8"], "X-Requestid": ["{4A70D028-6DF2-4D92-A34C-714D09F1A4DF}:1"]}, "status": 200}
2024/11/07 12:11:29.525 DEBUG   http.stdlib http: TLS handshake error from 120.46.22.78:10975: EOF
2024/11/07 12:11:29.661 DEBUG   http.stdlib http: TLS handshake error from 120.46.22.78:39977: EOF
2024/11/07 12:11:29.787 DEBUG   http.stdlib http: TLS handshake error from 120.46.22.78:57536: EOF
2024/11/07 12:11:29.903 DEBUG   http.stdlib http: TLS handshake error from 120.46.22.78:39978: EOF
2024/11/07 12:11:30.326 DEBUG   http.stdlib http: TLS handshake error from 120.46.22.78:27908: EOF
2024/11/07 12:11:30.413 DEBUG   http.stdlib http: TLS handshake error from 120.46.22.78:50750: EOF
2024/11/07 12:11:30.570 DEBUG   http.stdlib http: TLS handshake error from 120.46.22.78:36960: EOF
2024/11/07 12:11:30.706 DEBUG   http.stdlib http: TLS handshake error from 120.46.22.78:10152: EOF
2024/11/07 12:11:30.828 DEBUG   http.stdlib http: TLS handshake error from 120.46.22.78:14124: EOF
2024/11/07 12:11:30.887 DEBUG   events  event   {"name": "tls_get_certificate", "id": "3fc05f23-c73b-48f6-ad78-1ce6d6be9ecc", "origin": "tls", "data": {"client_hello":{"CipherSuites":[31354,4865,4866,4867,49196,49195,52393,49200,49199,52392,49162,49161,49172,49171,157,156,53,47,49160,49170,10],"ServerName":"mail.chouyulanxia.com","SupportedCurves":[39578,29,23,24,25],"SupportedPoints":"AA==","SignatureSchemes":[1027,2052,1025,1283,515,2053,2053,1281,2054,1537,513],"SupportedProtos":["http/1.1"],"SupportedVersions":[27242,772,771,770,769],"RemoteAddr":{"IP":"114.251.196.87","Port":53233,"Zone":""},"LocalAddr":{"IP":"172.21.32.4","Port":443,"Zone":""}}}}
2024/11/07 12:11:30.887 DEBUG   tls.handshake   choosing certificate    {"identifier": "mail.chouyulanxia.com", "num_choices": 1}
2024/11/07 12:11:30.887 DEBUG   tls.handshake   custom certificate selection results    {"identifier": "mail.chouyulanxia.com", "subjects": ["mail.chouyulanxia.com"], "managed": false, "issuer_key": "", "hash": "8aebf90ffe3e3262a35769b369a45f78f38f71de3b18f6c5a0cf0db86b07de20"}
2024/11/07 12:11:30.887 DEBUG   tls.handshake   matched certificate in cache    {"remote_ip": "114.251.196.87", "remote_port": "53233", "subjects": ["mail.chouyulanxia.com"], "managed": false, "expiration": "2025/01/19 00:00:00.000", "hash": "8aebf90ffe3e3262a35769b369a45f78f38f71de3b18f6c5a0cf0db86b07de20"}
2024/11/07 12:11:30.910 DEBUG   http.handlers.reverse_proxy selected upstream   {"dial": "bricking.com.cn:443", "total_upstreams": 1}
2024/11/07 12:11:30.919 DEBUG   http.handlers.reverse_proxy upstream roundtrip  {"upstream": "bricking.com.cn:443", "duration": 0.009314941, "request": {"remote_ip": "114.251.196.87", "remote_port": "53233", "client_ip": "114.251.196.87", "proto": "HTTP/1.1", "method": "POST", "host": "mail.chouyulanxia.com", "uri": "/EWS/Exchange.asmx", "headers": {"Content-Type": ["text/xml; charset=utf-8"], "X-Forwarded-For": ["114.251.196.87"], "Accept": ["*/*"], "User-Agent": ["AppleExchangeWebServices/818.120.2"], "Content-Length": ["622"], "Accept-Encoding": ["gzip, deflate, br"], "Accept-Language": ["zh-CN,zh-Hans;q=0.9"], "X-Forwarded-Proto": ["https"], "X-Forwarded-Host": ["mail.chouyulanxia.com"]}, "tls": {"resumed": false, "version": 772, "cipher_suite": 4865, "proto": "http/1.1", "server_name": "mail.chouyulanxia.com"}}, "headers": {"Date": ["Thu, 07 Nov 2024 12:11:30 GMT"], "Request-Id": ["b71d8f44-1f45-4dd1-aa5c-b8834557474f"], "X-Owa-Version": ["15.2.1544.4"], "Www-Authenticate": ["Basic realm=\"mail.chouyulanxia.com\"", "Negotiate", "NTLM"], "X-Feserver": ["EXCHANGE"], "Server": ["Microsoft-IIS/10.0"], "X-Powered-By": ["ASP.NET"], "Content-Length": ["0"]}, "status": 401}
2024/11/07 12:11:30.935 DEBUG   http.handlers.reverse_proxy selected upstream   {"dial": "bricking.com.cn:443", "total_upstreams": 1}
2024/11/07 12:11:30.943 DEBUG   http.handlers.reverse_proxy upstream roundtrip  {"upstream": "bricking.com.cn:443", "duration": 0.00882782, "request": {"remote_ip": "114.251.196.87", "remote_port": "53233", "client_ip": "114.251.196.87", "proto": "HTTP/1.1", "method": "POST", "host": "mail.chouyulanxia.com", "uri": "/EWS/Exchange.asmx", "headers": {"Accept-Encoding": ["gzip, deflate, br"], "User-Agent": ["AppleExchangeWebServices/818.120.2"], "X-Forwarded-Host": ["mail.chouyulanxia.com"], "X-Forwarded-Proto": ["https"], "Accept": ["*/*"], "X-Forwarded-For": ["114.251.196.87"], "Accept-Language": ["zh-CN,zh-Hans;q=0.9"], "Content-Length": ["622"], "Content-Type": ["text/xml; charset=utf-8"]}, "tls": {"resumed": false, "version": 772, "cipher_suite": 4865, "proto": "http/1.1", "server_name": "mail.chouyulanxia.com"}}, "headers": {"Www-Authenticate": ["Basic realm=\"mail.chouyulanxia.com\"", "Negotiate", "NTLM"], "Request-Id": ["aa153afe-188f-4429-a5be-4cc4bd6e6d33"], "X-Owa-Version": ["15.2.1544.4"], "X-Powered-By": ["ASP.NET"], "X-Feserver": ["EXCHANGE"], "Date": ["Thu, 07 Nov 2024 12:11:30 GMT"], "Content-Length": ["0"], "Server": ["Microsoft-IIS/10.0"]}, "status": 401}
2024/11/07 12:11:30.957 DEBUG   http.handlers.reverse_proxy selected upstream   {"dial": "bricking.com.cn:443", "total_upstreams": 1}
2024/11/07 12:11:30.958 DEBUG   http.handlers.reverse_proxy upstream roundtrip  {"upstream": "bricking.com.cn:443", "duration": 0.00096914, "request": {"remote_ip": "114.251.196.87", "remote_port": "53233", "client_ip": "114.251.196.87", "proto": "HTTP/1.1", "method": "POST", "host": "mail.chouyulanxia.com", "uri": "/EWS/Exchange.asmx", "headers": {"X-Forwarded-For": ["114.251.196.87"], "Content-Type": ["text/xml; charset=utf-8"], "Accept-Language": ["zh-CN,zh-Hans;q=0.9"], "X-Forwarded-Proto": ["https"], "Authorization": ["REDACTED"], "Accept": ["*/*"], "User-Agent": ["AppleExchangeWebServices/818.120.2"], "Content-Length": ["0"], "X-Forwarded-Host": ["mail.chouyulanxia.com"], "Accept-Encoding": ["gzip, deflate, br"]}, "tls": {"resumed": false, "version": 772, "cipher_suite": 4865, "proto": "http/1.1", "server_name": "mail.chouyulanxia.com"}}, "error": "stream error: stream ID 61; HTTP_1_1_REQUIRED; received from peer"}
2024/11/07 12:11:30.958 ERROR   http.log.error  stream error: stream ID 61; HTTP_1_1_REQUIRED; received from peer   {"request": {"remote_ip": "114.251.196.87", "remote_port": "53233", "client_ip": "114.251.196.87", "proto": "HTTP/1.1", "method": "POST", "host": "mail.chouyulanxia.com", "uri": "/EWS/Exchange.asmx", "headers": {"Authorization": ["REDACTED"], "Accept": ["*/*"], "Accept-Encoding": ["gzip, deflate, br"], "Content-Type": ["text/xml; charset=utf-8"], "Connection": ["keep-alive"], "User-Agent": ["AppleExchangeWebServices/818.120.2"], "Content-Length": ["0"], "Accept-Language": ["zh-CN,zh-Hans;q=0.9"]}, "tls": {"resumed": false, "version": 772, "cipher_suite": 4865, "proto": "http/1.1", "server_name": "mail.chouyulanxia.com"}}, "duration": 0.001056097, "status": 502, "err_id": "wqbd872w5", "err_trace": "reverseproxy.statusError (reverseproxy.go:1269)"}
2024/11/07 12:11:31.142 DEBUG   http.stdlib http: TLS handshake error from 120.46.22.78:35998: EOF
2024/11/07 12:11:31.807 DEBUG   http.stdlib http: TLS handshake error from 120.46.22.78:35999: EOF
2024/11/07 12:11:31.897 DEBUG   http.stdlib http: TLS handshake error from 120.46.22.78:36961: EOF
2024/11/07 12:11:31.908 DEBUG   http.stdlib http: TLS handshake error from 120.46.22.78:25934: EOF
2024/11/07 12:11:31.927 DEBUG   http.stdlib http: TLS handshake error from 120.46.22.78:18520: EOF
^C2024/11/07 12:11:32.392   INFO    shutting down   {"signal": "SIGINT"}
2024/11/07 12:11:32.392 WARN    exiting; byeee!! 👋  {"signal": "SIGINT"}
2024/11/07 12:11:32.392 INFO    http    servers shutting down with eternal grace period

2d. Workaround(s)

I can not find any workaroud, as long as I use caddy as reverse proxy, outlook 2013 will be completely down

2e. Relevant links

3. Tutorial (minimal steps to reproduce the bug)

  1. you have to install outlook 2013 on windows( because its http request seems include special binary data, I copied its curl request from charles, it even can not formatted as curl. and I can not obtain the exact binary), This is the curl request:

    curl -H "Cache-Control: no-cache" -H "Pragma: no-cache" -H "Content-Type: application/mapi-http" -H "Accept: application/mapi-http" -H "User-Agent: Microsoft Office/15.0 (Windows NT 6.2; Microsoft Outlook 15.0.4569; Pro)" -H "X-ClientApplication: Outlook/15.0.4569.1503" -H "X-ClientInfo: {BE5FCD7C-76DD-43E2-87B3-FE7C6ABBB143}:156" -H "X-RequestId: {6CBA0786-CD02-474F-A3C0-EAEC00386475}:1" -H "X-RequestType: Bind" -H "Host: [mail.chouyulanxia.com](http://mail.chouyulanxia.com/)" -H "Authorization: Basic emhhbmd6aGVAY2hvdXl1bGFueGlhLmNvbTpTYW5nZm9yQDEyMw==" --data-binary "
  2. run caddy server using below caddy config

    
    {
    debug
    }

mail.chouyulanxia.com:443 { tls /opt/feilian/agw/conf/cert/3_mail.chouyulanxia.com.crt /opt/feilian/agw/conf/cert/3_mail.chouyulanxia.com.key # self sign is ok reverse_proxy https://bricking.com.cn {

    transport http {
            tls
            tls_insecure_skip_verify
    }
    header_up Host {host}
}

}

``` shell
./caddy run --environ --config /etc/caddy/Caddyfile
  1. add host
    your_ip mail.chouyulanxia.com
  2. using my test account to log in, and you can reproduce it.
    # my account and password, after base64
    emhhbmd6aGVAY2hvdXl1bGFueGlhLmNvbTpTYW5nZm9yQDEyMw==
francislavoie commented 6 days ago

Looks like the proxy succeeded, it responded with "status": 200.

I can't read chinese (especially chinese from a screenshot that I can't copy the text from to put in a translator) so I don't know what that error is saying.

We can't help you debug application-level issues. If you can track down what exactly causes the problem then we can give you suggestions, but Caddy looks like it's working as intended.