Thank you for the response.
Currently requests to mymaindomain.com resolve to 11.22.33.44:80 correctly, and my applications pages are delivered ok.
Requests to mymaindomain.com/nr are met with a Http Error 502. Hitting 55.66.77.88:1880 as I’m trying to direct in the log files results in successful delivery of the application, however.
Are you able to provide an example of what I should be doing instead of the path matches? I’ve tried a number of things I can see from the documentation, but don’t seem to be getting anywhere. I do not control DNS, so cannot affect CNAME changes, like adding subdomains, etc. Controlling for path is, however, something I can use. The intention is to have a request to the domain, or any sub folder that doesn’t include /nr resolve to one application server that is serving a site on :80, and a request to the domain that includes /nr to point to another application server that is serving an application on :1880
When trying mymaindomain.com/nr I recieve a status message:
Cannot GET /nr
I have changed the Caddyfile to reflect the suggestions I understand.
{
email myemail@mymaindomain.com
debug
}
site.mymaindomain.com {
reverse_proxy /nr* http://55.66.77.88:1880
reverse_proxy /* 11.22.33.44:80
}
Using debug from this point on returns the following:
At the outset it looks like the remote server is refusing the connection - but the thing is if I hit 55.66.77.88:1880 then the server will provide the intended application just fine.
2022/03/08 10:16:08.885 INFO using adjacent Caddyfile
2022/03/08 10:16:08.888 WARN input is not formatted with 'caddy fmt' {"adapter": "caddyfile", "file": "Caddyfile", "line": 2}
2022/03/08 10:16:08.889 INFO admin admin endpoint started {"address": "tcp/localhost:2019", "enforce_origin": false, "origins": ["localhost:2019", "[::1]:2019", "127.0.0.1:2019"]}
2022/03/08 10:16:08.889 INFO http server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS {"server_name": "srv0", "https_port": 443}
2022/03/08 10:16:08.889 INFO http enabling automatic HTTP->HTTPS redirects {"server_name": "srv0"}
2022/03/08 10:16:08.890 DEBUG http starting server loop {"address": "[::]:443", "http3": false, "tls": true}
2022/03/08 10:16:08.890 DEBUG http starting server loop {"address": "[::]:80", "http3": false, "tls": false}
2022/03/08 10:16:08.890 INFO http enabling automatic TLS certificate management {"domains": ["mymaindomain.com"]}
2022/03/08 10:16:08.890 DEBUG tls loading managed certificate {"domain": "mymaindomain.com", "expiration": "2022/06/06 05:59:02.000", "issuer_key": "acme-v02.api.letsencrypt.org-directory", "storage": "FileStorage:/home/ec2-user/.local/share/caddy"}
2022/03/08 10:16:08.891 DEBUG tls.cache added certificate to cache {"subjects": ["mymaindomain.com"], "expiration": "2022/06/06 05:59:02.000", "managed": true, "issuer_key": "acme-v02.api.letsencrypt.org-directory", "hash": "c9450812e869aceaaf34d68a283fb7133aae411e7fa15985efe6cc5c137c0e72", "cache_size": 1, "cache_capacity": 10000}
2022/03/08 10:16:08.891 INFO autosaved config (load with --resume flag) {"file": "/home/ec2-user/.config/caddy/autosave.json"}
2022/03/08 10:16:08.891 INFO serving initial configuration
2022/03/08 10:16:08.891 INFO tls.cache.maintenance started background certificate maintenance {"cache": "0xc00053dea0"}
2022/03/08 10:16:08.891 INFO tls cleaning storage unit {"description": "FileStorage:/home/ec2-user/.local/share/caddy"}
2022/03/08 10:16:08.892 INFO tls finished cleaning storage units
2022/03/08 10:16:11.591 DEBUG tls.handshake choosing certificate {"identifier": "mymaindomain.com", "num_choices": 1}
2022/03/08 10:16:11.591 DEBUG tls.handshake default certificate selection results {"identifier": "mymaindomain.com", "subjects": ["mymaindomain.com"], "managed": true, "issuer_key": "acme-v02.api.letsencrypt.org-directory", "hash": "c9450812e869aceaaf34d68a283fb7133aae411e7fa15985efe6cc5c137c0e72"}
2022/03/08 10:16:11.591 DEBUG tls.handshake matched certificate in cache {"subjects": ["mymaindomain.com"], "managed": true, "expiration": "2022/06/06 05:59:02.000", "hash": "c9450812e869aceaaf34d68a283fb7133aae411e7fa15985efe6cc5c137c0e72"}
2022/03/08 10:16:11.732 DEBUG http.handlers.reverse_proxy upstream roundtrip {"upstream": "55.66.77.88:1880", "duration": 0.004099742, "request": {"remote_addr": "43.245.160.163:50239", "proto": "HTTP/2.0", "method": "GET", "host": "mymaindomain.com", "uri": "/nr", "headers": {"Sec-Fetch-Dest": ["document"], "Cookie": ["_ga=GA1.4.108457131.1645305609; wf_loginalerted_49ffc0b821102931d068b7166f82c16af328fc58e14540c4a7fe41fc4ed9961e=6dc650d3040c72c96bbc12dc093fbf63eee41e51c13ba920a3a1d39806e63bbd; wp-settings-1=libraryContent%3Dbrowse%26advImgDetails%3Dshow%26urlbutton%3Dnone%26editor%3Dtinymce%26siteorigin_panels_setting_tab%3Dgeneral%26hidetb%3D1%26posts_list_mode%3Dlist; wp-settings-time-1=1645305631; visid_incap_724216=BNkOBZJNTqSTYZmToZ+uTLB4FGIAAAAAQUIPAAAAAAB6AVp340sE9I0ysx8Es8xB; wf_loginalerted_e0a8157f9e573d5cff9a1e1fe27babd01a5e168da0bbffb47e99a7da12e719a5=6146fbb2dca4718dc23fef454dfc2e257fbd3a762cf3af54dc280b9053d156bd; wordpress_test_cookie=WP%20Cookie%20check; wordpress_logged_in_377fc503a3d94ab6ba73dd7ea7e0da85=catalystadmin01%7C1646572960%7CogzOTLVesr0OQTA3ubjuu2W1zu4uWvY3YfODAzZcS0T%7C48080dc9bd86f9f4c4cdee13d6a2873a7e7ed6daaf92a93441ed0dddcbf73762; wp_lang=en_US; _gid=GA1.4.1565826196.1646733499"], "Sec-Fetch-Mode": ["navigate"], "Sec-Ch-Ua-Mobile": ["?0"], "User-Agent": ["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36"], "Accept": ["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"], "Sec-Fetch-Site": ["none"], "Accept-Language": ["en-AU,en-GB;q=0.9,en-US;q=0.8,en;q=0.7"], "Cache-Control": ["max-age=0"], "Upgrade-Insecure-Requests": ["1"], "Sec-Ch-Ua-Platform": ["\"Windows\""], "Sec-Fetch-User": ["?1"], "Accept-Encoding": ["gzip, deflate, br"], "X-Forwarded-For": ["43.245.160.163"], "X-Forwarded-Proto": ["https"], "Sec-Ch-Ua": ["\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"98\", \"Google Chrome\";v=\"98\""]}, "tls": {"resumed": false, "version": 772, "cipher_suite": 4865, "proto": "h2", "proto_mutual": true, "server_name": "mymaindomain.com"}}, "headers": {"Content-Security-Policy": ["default-src 'none'"], "Content-Type": ["text/html; charset=utf-8"], "Connection": ["keep-alive"], "Keep-Alive": ["timeout=5"], "Access-Control-Allow-Origin": ["*"], "X-Powered-By": ["Express"], "X-Content-Type-Options": ["nosniff"], "Content-Length": ["141"], "Date": ["Tue, 08 Mar 2022 10:16:11 GMT"]}, "status": 404}
Additionally, curl -v shows:
> curl -v mymaindomain.com/nr
* Trying 1.2.3.4:80...
* Connected to mymaindomain.com (1.2.3.4) port 80 (#0)
> GET /nr HTTP/1.1
> Host: mymaindomain.com
> User-Agent: curl/7.79.1
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 308 Permanent Redirect
< Connection: close
< Location: https://mymaindomain.com/nr
< Server: Caddy
< Date: Tue, 08 Mar 2022 10:08:07 GMT
< Content-Length: 0
<
* Closing connection 0