Caddy as reverse proxy over Tomcat Google Chrome causing error

  1. caddy version 1.0.3

  2. I am running caddy with CORS plugin.
    a. environment: Windows 64 bit (server 2016)
    b. command: caddy -port 443 -host server_host_here -conf config.txt
    c. Service/unit/compose file:
    d. Caddyfile:
    server_name_here
    gzip
    log log/access.log
    errors log/error.log {
    403 htdocs/403.html # error page
    404 htdocs/404.html # Not Found error page
    500 htdocs/500.html # Internal server error page
    * htdocs/default_error.html # catch all error page
    }
    proxy /app http://172.20.30.245:8080 {
    transparent
    }
    proxy /i http://172.20.30.245:8080 {
    transparent
    }

  3. The problem I’m having:
    My application works fine over Firefox. Over Chrome I get an error as soon as I attempt to log in. This error is coming from Oracle ORDS.
    “403 Forbidden. 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 replace Apache HTTPD with Caddy. HTTPD works fine with the directive: RequestHeader set Origin http://localhost:8080
    Is Chrome adding its own headers and messing things up??

  4. Error messages and/or full log output: see #3

  5. What I already tried: I’ve tried a variety of directives along with transparent, manually to reproduce “transparent”. Mostly just flogging around though.

  6. Links to relevant resources: none

It looks like you are missing a cors config line in your Caddyfile.

See:
https://caddyserver.com/docs/http.cors

I did try using the package with the cors plugin and used the cors directive. To no avail.

Consider using Fiddler to check the details of the request and response to and from Caddy with the Caddyfile configured with cors added.

1 Like