Caddy v2.2 reverse proxy over Oracle ORDS

Caddy v2.2 fresh installed on Windows Server 2016 on 09/27/2020

I am attempting to run Caddy 2.2 as a reverse proxy over Apache Tomcat which is running Oracle ORDS

caddyfile=
website_name:443

file_server
reverse_proxy /app/* localhost:8080
reverse_proxy /i/* localhost:8080

I am using “caddy run” from the command line to run caddy.

I get the following error when I attempt to hit the website:
“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 currently running things successfully with Apache HTTPD, and I would like to switch to Caddy for ease of SSL and ease of configuration in general.

I just need help getting the reverse_proxy options correct. Please help.

I’m not sure what value ORDS is expecting, but this is how you set the Host header on the proxy:

reverse_proxy /app/* localhost:8080 {
	header_up Host example.com
}

By default, Caddy passes through the header from the originating request, but it seems like ORDS is expecting something else. Using header_up can override it.

By the way, since you have two different paths you want to proxy to, you can used a named matcher to simplify your config (avoid having two reverse_proxy directives):

@ords path /app/* /i/*
reverse_proxy @ords localhost:8080 {
	header_up Host example.com
}

caddyfile is now:
dev.example.com:443

file_server
reverse_proxy /app/* localhost:8080 {
header_up Host dev.example.com
}
reverse_proxy /i/* localhost:8080 {
header_up Host dev.example.com
}

I get exactly the same result

This topic was automatically closed after 30 days. New replies are no longer allowed.