The whole Caddyfile is not needed…just this route
3. The problem I’m having:
I don’t know much about rewrite URIs, but will explain the problem and see if anyone can help me:
I have a Hikvision camera that I have a reverse proxy to as above in the route snippet. When I go to the camera via the proxy it gets a lot of 404 errors.
When I go to localhost/hikvision is get taken to http://localhost/hikvision/doc/page/login.asp?_1597949745828
If I try to login, I get this message in the chrome dev tools: GET http://localhost/ISAPI/Security/userCheck 404 (Not Found)
This really should be trying to get: http://localhost/hikvision/ISAPI/Security/userCheck if I am correct, for things to work correctly with the reverse proxy.
4. Error messages and/or full log output:
error displayed above
5. What I already tried:
Trying to understand rewrite rules, but not even sure if I am on the right track…
Thaks, @francislavoie. That is a good read, but I am no further ahead. I have several other IPs I proxy. One is a weather station, which has no issues. Others are to software I wrote, which has no issues (I had to write special code handle for it to work behind a NAT, so I assume that fix also solved the reverse_proxy bit).
However, any advice on the PTZ (Onvif compliant) camera? I also have several remote cameras, from different manufacturers, but they all exhibit this issue. And likely, with rewrite rules of some sorts, you’d have to know which PTZ is being connected too and provide the rewrite rule for that type of camera?
If they don’t behave well with a subpath proxy and you have no way to configure them, then I recommend trying with a subdomain. You can edit your /etc/hosts file and add some .local domains that map to 127.0.0.1 and use those as separate site blocks for those other services.