1

I am trying to use Apache as reverse proxy.

For some locations I want to convert the client's HTTPS request to HTTP requests on the server.
For another location I want to keep the client's HTTPS request to also be a HTTPS request on the server.

I cannot get this to work, because directives like SSLProxyEngine on cannot be used inside a <Location> block.

The setup I have is this:

<VirtualHost _default_:443>
    ServerName mysite.com
    ServerAlias www.mysite.com

    # THIS LOCATION I WANT TO BE HTTPS (client) --> HTTPS (server)
    <Location /_nuxt/>
      allow from all 
      satisfy any 

      ProxyPreserveHost On
      ProxyPass https://myserver.docker:1304/_nuxt/
      ProxyPassReverse https://myserver.docker:1304/_nuxt/
    </Location>

    # THIS LOCATION I WANT TO BE HTTPS (client) --> HTTP (server)
    <Location ~ ".*">
      # .* is a wildcard for any location
      AuthType openid-connect
      Require valid-user

      ProxyPreserveHost On
      ProxyPass http://myserver.docker:3000/
      ProxyPassReverse http://myserver.docker:3000/
    </Location>

    SSLCertificateFile "/some/location/server.crt"
    SSLCertificateKeyFile "/some/location/server.key"
    LoadModule ssl_module modules/mod_ssl.so
    SSLProxyEngine on
    RequestHeader set X-Forwarded-Proto “https”
    RequestHeader set X-Forwarded-Port “443”    
</VirtualHost>

How can I get one location with SSL-Proxy and the other without SSL-Proxy?

Hendrik Jan
  • 111
  • 3

0 Answers0