Caddy as reverse proxy and https

I am attempting to use caddy as reverse proxy and https over apache tomcat and oracle ords. I need a caddy config item like apache httpd ProxyPreserveHost On
Is there a config item?

ProxyPreserveHost forwards the Host header from the client to the upstream server.

The header_upstream subdirective for proxy is the equivalent you’re looking for (see https://caddyserver.com/docs/proxy).

You need to give it the Host header, which you can get from a placeholder (see https://caddyserver.com/docs/placeholders).

The transparent proxy preset has the correct syntax built in, too (with some other features useful for reverse proxies as well, see https://caddyserver.com/docs/proxy#presets).

header_upstream Host {host}

I am using 0.10.10 and am using transparent but still get “the request cannot be processed because this resource does not support cross origin sharing requests, or the request origin is not authorized to access this resource. If ords is being reverse proxied ensure the front end server is propagating the host name, for mod_proxy ensure ProxyPreserveHost is set to On”. I am attempting to switch from apache httd to caddy. I have things working fine with httpd using ProxyPreserveHost on.

I think you may have misunderstood - to be unambiguous, ProxyPreserveHost is not a Caddy directive. I was simply noting the function of Apache’s configuration to compare with Caddy’s equivalent (which would be header_upstream Host {host}).

I edited my reply, as I figured that out :slight_smile:

No worries, but I’m a bit stumped.

If the following is true:

  1. It works with httpd ProxyPreserveHost On
  2. Apache docs say that ProxyPreserveHost forwards the client’s Host header
  3. It doesn’t work with Caddy’s transparent preset or header_upstream Host {host}

Then the implication is that your upstream tests for something that httpd ProxyPreserveHost does that is not documented. I’m not really sure how to advise from here.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.