Apache - Redirect user to url via Proxy - apache

I have an Apache webserver. Now users can access the apache front end url, which is:
http://192.168.32.32
Now, when the user visits that url, apache should automatically redirect him to a new url, but via a proxy server on a specific port: 192.169.34.34 3128
The redirect url can only be accessed via the proxy server, and apache can access the proxy server because they are on the same domain.
How do you do this in apache?
Thanks!

I am not 100% certain on what you want to do, but I think what you are after can be achieved with mod_proxy in combination with mod_rewite. I could be that you only need mod_proxy, I guess it depends on how much tuning options you want.
Maybe ProxyPassReverse is what you are after?

Related

Apache : mod_rewrite : Redirect URL from abc.com to abc.com/xyz without changing the URL in browser

I have tried different things like below but no luck :
Redirect "/" "REPLACE WITH YOUR COMPLETE URL" in virtual host.
Redirect permanent "/one" "Replace with your complete URL" in virtual host.
Outside Virtual Host:
<Location "/">
Redirect permanent "REPLACE WITH YOUR COMPLETE URL"
</Location>
But in all the cases, URL in the browser changes to the replaced URL, which we don't want.
Actual values :
/ to be redirected to /olyweb
How would I use URL Masking or something which can redirect internally but don't reflect on browser.
The browser will always display the URL it is talking to. It cannot be fooled.
You can only do what you want by letting your Apache httpd act as a reverse proxy. You cannot do it with things like mod_rewrite.
In a reverse proxy the httpd will sit in front of your target web server. All communication to and from your target web server will travel through the httpd. Therefore you can effectively access your target web server via an alternative URL. Unlike with HTTP Redirect solutions your browser will in the reverse proxy scenario never actually know that all content comes from the target web server. Your browser never communicates with the target web server, it communicates with your httpd process.

Redirect from a URL to a other server

I have the following question that I do not know how to solve it in the most efficient way.
I have two servers, one with Apache where I have a Wordpress instance responding for port 80, and on another server I have a Wildfly with another application listening on port 8080. The Wordpress that I have configured on the Apache server, responds to the URL http://www.somedomain.com What I'm not so clear about is how to do when a request arrives at http://www.somedomain.com/yyyy and redirects me to the Wildfly server where an application is responding to the URL : 8080 / app
How could I do it in the most effective way? Using the rewrite module in the .htaccess file or using the Apache proxy module and configuring it in the Apache virtual host? How would I have to do it?
Thank you very much in advance.
You're mixing a few things that are not related to each other. First of all, a redirect is something different than a proxy. Redirecting means asking the client (browser) to look at another URL. A proxy, on the other hand, retrieves the content of the other URL itself and passes it to the client. Using a proxy, the other URL remains invisible to the client.
Second, mod_rewrite is not limited to htaccess configuration. In fact it's better to configure mod_rewrite in the virtual host configuration, just as you suggested with the proxy configuration.
The htaccess is simply for users who are not allowed to mess with the server configuration itself. Configuration in the htaccess can be limited by the admin for security purposes at the cost of slowing down the server.
That said, if you are looking to map your wildfly server paths into your main server's paths, you might want to use something like this inside your main server's virtual host block:
<Location "/yyyy">
ProxyPass "http://wildfly:8080/app"
</Location>
See http://httpd.apache.org/docs/current/mod/mod_proxy.html#proxypass for detailed explanations.

Glassfish - Domain wise redirection to application

I am running Glassfish Server on Linux 6 for my Oracle Apex applications running on Port 8080 and 8181(for https).
now, suppose my domain is mydomain.com,
and when I access
a.mydomain.com -> it should be redirected to application 1 (i.e a.mydomain.com:8080/apex/f?p=1)
b.mydomain.com -> it should be redirected to application 2 (i.e b.mydomain.com:8080/apex/f?p=2)
and so on...
if it is hard to figure out with Glassfish, I can also move to Apache Tomcat if required.
Any advice/idea would be greatly appreciable.
I don't know Glassfish, but you might try ProxyPass inside your virtual host config
ProxyPass / http://a.mydomain.com:8080/apex/f?p=1
Similar for the b.mydomain.com domain.
If you really want a redirect, i.e. the browser's URL changes, use Redirect instead
Redirect / http://a.mydomain.com:8080/apex/f?p=1

apache redirect to SSL configured site

I am trying to setup a gitlab repository and I am quite new to the web server side of things. My setup is the following:
I have an apache server which is running my main website on port 8080.
I have the gitlab configured with SSL and Nginx and running on port 2443.
At the moment, the gitlab site can be accessed through https://www.example.com:2443.
What I would like to do is setup a redirect through my apache server where if someone comes to http://www.example.com/gitlab or https://www.example.com/gitlab, they get redirected to ``https://www.example.com:2443` (preferably without the web browser text field changing).
Could this be done easily with Apache? Also, since the redirect is to an SSL site, any special things we need to consider?
You can try adding the redirect directive to your Apache VirtualHosts (8080 and 443).
Redirect permanent /gitlab https://www.example.com:2443

Apache WebSphere Plugin home page

We currently have Apache/ WAS setup and I want the Apache to handle the static content and it is working as expected.
My question:
We have always used www.xxx.com before and WAS used to handle the page, now we want to WEB server to handle the page and route www.xxx.com to www.xxx.com/index.jsp without the user knowing about it.
We want to user to type in www.xxx.xom in the url and get to the WAS through Apache.
If I get you correctly, you want a reverse proxy for dynamic content of your website. Apache has the mod_proxy that allows you to do that for selective URLs. The ProxyPass directive allows you to specify what URLs are mapped to which HTTP servers. HTTP headers are modified accordingly that the external information can reach the WAS that is hidden behind your Apache. IIRC, WAS can be configured to be aware of the reverse proxy.
Reverse proxy based on a prefix:
ProxyPass /mirror/foo/ http://backend.example.com/
Reverse proxy based on a regex:
ProxyPassMatch ^(/.*\.gif)$ http://backend.example.com$1