Thank you for the quick reply!
I modified my Caddyfile to this:
{
debug
}
burrowhq.com {
root * /home/ec2-user/burrow/my-app/build
@notApi not path /api/*
handle @notApi {
try_files {path} {path} /index.html
}
file_server
}
But I’m still unable to get this to work for https//burrowhq.com (haven’t tried the reverse proxy part yet, but it’s not serving the javascript bundle correctly). The index.html file is being served correctly, but it seems like when requesting other files in static, index.html is being returned as well (from investigating on the Chrome Network tab).
I added the debug part and got these logs:
2020/08/16 14:53:01.055 DEBUG http.handlers.rewrite rewrote request {"request": {"method": "GET", "uri": "/", "proto": "HTTP/2.0", "remote_addr": "100.26.166.233:37472", "host": "burrowhq.com", "headers": {"Accept-Encoding": ["gzip"], "User-Agent": ["Go-http-client/2.0"]}, "tls": {"resumed": false, "version": 772, "ciphersuite": 4865, "proto": "h2", "proto_mutual": true, "server_name": "burrowhq.com"}}, "method": "GET", "uri": "/index.html"}
2020/08/16 14:54:01.090 DEBUG http.handlers.rewrite rewrote request {"request": {"method": "GET", "uri": "/", "proto": "HTTP/2.0", "remote_addr": "100.26.166.233:37472", "host": "burrowhq.com", "headers": {"Accept-Encoding": ["gzip"], "User-Agent": ["Go-http-client/2.0"]}, "tls": {"resumed": false, "version": 772, "ciphersuite": 4865, "proto": "h2", "proto_mutual": true, "server_name": "burrowhq.com"}}, "method": "GET", "uri": "/index.html"}
2020/08/16 14:55:01.125 DEBUG http.handlers.rewrite rewrote request {"request": {"method": "GET", "uri": "/", "proto": "HTTP/2.0", "remote_addr": "100.26.166.233:37472", "host": "burrowhq.com", "headers": {"Accept-Encoding": ["gzip"], "User-Agent": ["Go-http-client/2.0"]}, "tls": {"resumed": false, "version": 772, "ciphersuite": 4865, "proto": "h2", "proto_mutual": true, "server_name": "burrowhq.com"}}, "method": "GET", "uri": "/index.html"}
2020/08/16 14:55:08.375 DEBUG http.handlers.rewrite rewrote request {"request": {"method": "GET", "uri": "/", "proto": "HTTP/2.0", "remote_addr": "96.239.119.109:52469", "host": "burrowhq.com", "headers": {"Accept-Language": ["en-US,en;q=0.9"], "If-Modified-Since": ["Sun, 16 Aug 2020 14:35:56 GMT"], "Upgrade-Insecure-Requests": ["1"], "Sec-Fetch-Mode": ["navigate"], "Sec-Fetch-Dest": ["document"], "Accept-Encoding": ["gzip, deflate, br"], "Sec-Fetch-User": ["?1"], "If-None-Match": ["\"qf5v7w1r8\""], "User-Agent": ["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36"], "Accept": ["text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"], "Purpose": ["prefetch"], "Sec-Fetch-Site": ["none"]}, "tls": {"resumed": false, "version": 772, "ciphersuite": 4865, "proto": "h2", "proto_mutual": true, "server_name": "burrowhq.com"}}, "method": "GET", "uri": "/index.html"}
2020/08/16 14:56:01.160 DEBUG http.handlers.rewrite rewrote request {"request": {"method": "GET", "uri": "/", "proto": "HTTP/2.0", "remote_addr": "100.26.166.233:37472", "host": "burrowhq.com", "headers": {"Accept-Encoding": ["gzip"], "User-Agent": ["Go-http-client/2.0"]}, "tls": {"resumed": false, "version": 772, "ciphersuite": 4865, "proto": "h2", "proto_mutual": true, "server_name": "burrowhq.com"}}, "method": "GET", "uri": "/index.html"}
Please let me know if I can provide any more context here and thanks again for the help!
Btw removed the redundant redirect from http => https, good callout!