ProxyPreserveHost equivalent

Hi.
I'm trying to expose oracle apex with traefik 2.3 in a docker swarm.
After the login page, however, I get the following message:
The request could not be processed because this resource does not support Cross Origin Sharing requests or because the request source is not authorized to access this resource. If you use the reverse proxy function with ords, make sure the front-end server propagates the host name; for mod_proxy make sure 'ProxyPreserveHost' is set to 'On'.

I tried to add middleware to fix the CORS error, but without success:

   labels:
        - traefik.http.middlewares.oracle-cors.headers.accesscontrolallowmethods=GET,OPTIONS,PUT,HEAD,POST
        - traefik.http.middlewares.oracle-cors.headers.accessControlAllowOriginList=*
        - traefik.http.middlewares.oracle-cors.headers.accessControlExposeHeaders=*
        - traefik.http.middlewares.oracle-cors.headers.addvaryheader=true 
        - traefik.http.middlewares.oracle-cors.headers.hostsProxyHeaders=X-Forwarded-Hosts
        
        - traefik.enable=true
        - traefik.docker.network=traefik-public
        - traefik.http.routers.oracle.rule=Host("oracle.xxxxx.space")
        - traefik.http.routers.oracle.entrypoints=http
        - traefik.http.routers.oracle.middlewares=https-redirect
        - traefik.http.routers.oracle.service=oracle-dummy
        - traefik.http.services.oracle-dummy.loadbalancer.server.port=9999

        - traefik.http.routers.oracle-https.rule=Host("oracle.xxxxx.space")
        - traefik.http.routers.oracle-https.entrypoints=https
        - traefik.http.routers.oracle-https.tls=true
        - traefik.http.routers.oracle-https.middlewares=oracle-cors
        - traefik.http.routers.oracle-https.service=oracle-https
        - traefik.http.services.oracle-https.loadbalancer.server.port=8080
        - traefik.http.services.oracle-https.loadbalancer.passHostHeader=true

how can I "emulate" the "ProxyPreserveHost" option of mod_proxy?
Someone also recommend using "RequestHeader unset Origin". How can I do this in traefik?

thanks a lot to everyone!

1 Like

Necroing an old thread since I have the same problem. Anyone got a solution for what @FilippoBozzi asked? E.g. "emulate" the "ProxyPreserveHost" option of mod_proxy and/or "RequestHeader unset Origin" ?

Still looking for this

And still looking for a solution.

Great to be so persistent.

How about you post your Traefik static and dynamic config, and docker-compose.yml if used. Tell us what exactly is not working, what are the error messages.

Check Traefik dashboard and Traefik debug log.

From the doc:

The passHostHeader allows to forward client Host header to server.
By default, passHostHeader is true.

As far as I understand, the proxy from https to http causes the CORS violation...

Based on Oracle's Doc ID 2139195.1, I added

<entry key="security.forceHTTPS">true</entry>

to my /etc/ords/config/global/settings.xml file (ORDS 23c) and it seems to work.

1 Like

Thank you so much for that! That was all it took to get it working!