httpd reverse-proxy in front traefik ingress from kubernetes - apache

I have a kubernetes cluster. I am using traefik to create ingress.
Traefik is creating the ingress like the following name app1.192.168.0.10.nip.io
I would like set the httpd reverse proxy in front of traefik.
Code example from HTTPD:
app1
ProxyPreserveHost On
ProxyPass /kubernetes/app1 http://app1.192.168.0.10.nip.io:80
ProxyPassReverse /kubernetes/app1 http://app1.192.168.0.10.nip.io:80
In the browser, I have tried https://somedomain.com/kubernetes/app1 and it return 404, but if I use http://app1.192.168.0.10.nip.io, the browser return the content.
I have other proxypass (no kubernetes) and it works perfect.

The problem was solved:
I have put de root path from reverse proxy to root path ingress but I have modified the traefik with another configuration.

Related

Apache2 reverse proxy to a nextcloud server does not work

I've made a Ubuntu 18.04 Reverse Proxy Server with Apache2 and it works. I can reverse proxy to another apache2 webserver with no problem.
But now I want to do the exact same thing to a nextcloud server but it does not work.
My steps:
1) I copied the old configuration
2) changed the external Domain and the internal IP Adress from the Server
3) now I restarted the apache2 server and it does not work
There is no error in the error.log file from apache.
Maybe there is an error on the nextcloud server but I don't know how to continue.
Thanks Raphael
This is my working config for the Apache proxy pointing to the local Nextcloud in a Docker based instance:
ProxyPreserveHost On
ProxyRequests Off
ServerName cloud.myserver.local
ServerAlias cloud
ProxyPass / http://localhost:8000/
ProxyPassReverse / http://localhost:8000/

Apache reverse proxy in front of an ingress-gce (GKE)

I´m trying to overcome the ingress-gce limitation of redirect traffic from HTTP to HTTPS.
So, the easiest configuration whould be a Reverse Proxy with Apache2 but isn't working for me, this apache is in another VM apart from my kubernetes cluster, I just want to "proxy" the traffic so I can manipulate the request, redirect to https, etc
I´m need this specific solution to work as I can´t configure a nginx ingress at this point, it has to be done with this GCE ingress
My ingress yaml configuration is:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: my-ingress
annotations:
kubernetes.io/ingress.global-static-ip-name: my-reserved-address
kubernetes.io/ingress.allow-http: "false"
spec:
tls:
- hosts:
- mycustom.domain.com
secretName: mydomain-com-certificate
rules:
- host: mycustom.domain.com
http:
paths:
- path: /*
backend:
serviceName: tomcat-service
servicePort: 80
- path: /app/*
backend:
serviceName: spring-boot-app-service
servicePort: 80
My apache virtualhost configuration is:
<VirtualHost *:80>
ServerName myother.domain.com
Redirect permanent / https://myother.domain.com/
</VirtualHost>
<VirtualHost *:443>
ServerName myother.domain.com
ProxyPreserveHost On
ProxyRequests On
ProxyPass / https://mycustom.domain.com/
ProxyPassReverse / https://mycustom.domain.com/
SSLEngine on
SSLProxyEngine on
SSLProtocol All -SSLv2 -SSLv3
SSLCipherSuite ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:!RC4:+HIGH:+MEDIUM
SSLCertificateKeyFile /etc/ssl/domain.com/domain.com-privatekey-nopass.pem
SSLCertificateFile /etc/ssl/domain.com/domain.com.crt
SSLCACertificateFile /etc/ssl/domain.com/IntermediateCA.crt
</VirtualHost>
Every piece of the puzzle is working independent as expected, I mean, if I go to any of the following
A) https://mycustom.domain.com/tomcat_context
B) https://mycustom.domain.com/app/hello
I get the desired results, A) I get my web page and B) I get a simple response from my app
However, when I use the proxy http://myother.domain.com/tomcat_context I can see how it transform to but I always get a TEXT response from the cluster, always is
default backend - 404
I´m also checking the Apache2 logs and I can see how the correct invocation is being made internally by apache
[Wed May 22 18:39:40.757619 2019] [proxy:debug] [pid 14196:tid 140335314564864] proxy_util.c(2213): [client xxx.xxx.xxx.xxx:52636] AH00944: connecting https://mycustom.domain.com/tomcat_context to mycustom.domain.com:443
I can´t find an explanation why this is happening if all the pieces are working properly, at the end of the day my ingress-gce is like an external service to my apache proxy, it should be working already.
Also both configurations, the ingress and the apache have SSL configured and its the same exact certificate as both are running on the same domain
Any help will be appreciated
The ingress controller doesn't have a handler for myother.domain.com so produces a 404.
You either need to setup an additional Ingress host for myother.domain.com or turn ProxyPreserveHost Off so the proxy sends the mycustom.domain.com host name from the ProxyPass config.
How the tomcat application make use of the Host header is usually the decider for which way you need to map the header through the proxy.

Configure apache2 and host to pass traffic to a docker container with nginx

I'm currently running a ubuntu webserver with apache2, hosting multiple sites and subdomains. I would like to host bitwarden on my own webserver, which is only shipped in a docker container with nginx.
I would like to use a subdomain e.g. bitwarden.domain.com to access bitwarden. But I have no idea how to configure apache2 / host to pass through traffic going to bitwarden.domain.com to the docker container running bitwarden (without affecting the other domains).
My question: How to configure apache2/docker to achieve this? Is there any documentation/tutorial for this?
After starting the docker container, grab the container ip, port:
local_docker_ip, local_docker_port
And you have a couple of options:
Use apache2 Virtual host with a redirect:
<VirtualHost *:80>
ServerName bitwarden.domain.com
Redirect permanent / http://{local_docker_ip}:{local_docker_port}/
</VirtualHost>
Or use the apache2 proxy module. First, enable proxy modules by running the commands:
a2enmod proxy
a2enmod proxy_http
Then, add the following virtual host:
<VirtualHost *:80>
ProxyPreserveHost On
ProxyRequests Off
ServerName bitwarden.domain.com
ProxyPass / http://{local_docker_ip}:{local_docker_port}/
ProxyPassReverse / http://{local_docker_ip}:{local_docker_port}/
</VirtualHost>
I hope it helps

Doing a proxy pass server on apache to tomcat+liferay

I have three sites hosted on liferay, and they use only one portal instance, therefore only one tomcat host.
I configured the virtual host properties on liferay, so when I type www.domain1.com, it goes to the right site.
However, when I type domain1.com, without the www prefix, it goes to the default liferay site.
One solution that I got was to do a proxy and rewrite server with apache 2, with mod_proxy_http and mod_rewrite modules.
The sites like domain1.com are rewritten to www.domain1.com, and I do a proxy pass like this:
ProxyPass / http://localhost:8085
ProxyPassReverse / http://localhost:8085
The tomcat server listens to the 8085 port, and apache listens to 8080.
But when the proxy pass goes on, I get a 403 - forbidden status.
I don't have a site hosted on apache, and I think that's why I got this status.
But I don't want to have any sites on apache, because the sites are on tomcat.
Is there a way to do this proxy setup without hosting a site on apache? Or maybe hosting a
"dummy" site, just to get the proxypass to work.
Specs:
Liferay 6.1
, Tomcat 7.0.27
, Apache 2.x
, Ubuntu Server 12.04
Best Regards!
Guilherme
try it without "/"
ProxyPass http://localhost:8085
ProxyPassReverse http://localhost:8085
or, maybe, you can do it with tomcat configuration: http://tomcat.apache.org/tomcat-6.0-doc/config/host.html#Host_Name_Aliases

How to use Apache as a proxy for JBOSS AS?

I have Apache running and serving PHP but I will also like to run JBOSS for my other web app. JBOSS is running on port 8080 while Apache is running on port 80. If there is a request for URL example.com, I want Apache to handle it because it is PHP backend but for URL example2.com, I want Apache to forward the request to port 8080 to be handled by JBOSS AS.
I appreciate any help in configuring Apache in the way I described it.
You need to use Apache proxy module: http://httpd.apache.org/docs/1.3/mod/mod_proxy.html
Your configuration of proxy will look similar to:
ProxyRequests Off
ProxyPass /foo http://foo.example.com:8080/foo