Apache Redirect URL or Web Translation - apache

I am a total newb at Apache. So any help with this would be awesome.
So I have an application that's running on a Red Hat web server using Apache. Currently when you hit the base web server URL it gives the standard apache web page. I would like users who visit
http://www.mysite/ and www.mysite/app1
to be redirected to http://www.mysite:8080/app1. How would I go about doing this?
Also, is it possible to hide the redirect address (mostly the :8080) and just show the redirected URL?

you should use mod_proxy from apache like this in your wirtual host
ProxyPass / http://www.mysite.com:8080/
ProxyPass /app1 http://www.mysite.com:8080/app1
to enable this in debian
a2enmod proxy_http

Related

How to configure Apache forward to IIS

My website running on IIS 8.0.
I was install Ubuntu on another machine, and setup Apache and Varnish on it.
Now, I want how to configure Varnish and Apache when visitors access Apache that it will forward to my Website on IIS.
Please help me!!!
As your question, you need varnish and apache to send the visitor to IIS Server .
I could not understand why you need apache to send To IIS which will cause your page load slower due to unnecessary routing.
But to answer your query
in apache config:
sudo vi /etc/apache2/apache2.conf
add below
ProxyPass "/" "http://IISserverip/"
ProxyPassReverse "/" "http://IISserverip/"
hope this resolve your requirement

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 - Redirect user to url via Proxy

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?

Apache .htaccess whitelist doesn't block Tomcat with Mod_jk

My problem is, that I recently set up a Tomcat7 application container with Apache2.2 Frontend. As the project is still under development I am controlling access by an IP whitelist set up in .htaccess for the domain.
I set up mod_jk via AJP13 to Tomcat, it works absolutely fine, except the fact that .htaccess doesn't block the forward for Tomcat. In other words if you enter www.mydomain.com from a "black" IP, you get forwarded to the error page but if you enter www.mydomain.com/AppContext you slip through Apache into Tomcat
I started messing with urlrewritefilter with Tomcat, but for some reason it didn't work.
I am wondering if there is any way to set up .htaccess or apache instead to block requests forwarded to Tomcat similarly to request for Apache?
Also noticed a dramatic speed decrease when using it like that, us that common when using Apache as a frontend?
.htaccess files will work only when Apache is using a <Directory> based configuration (in httpd.conf). In case of mod_jk, matching requests (as specified by JkMount directive) will simply be forwarded to the AJP connector.
Use <Location> to control access instead:
<Location "/AppContext">
Order Deny,Allow
Deny from all
Allow from .myCompany.local
</Location>
See <Location> Directive> for details.
I faced the same problem and found a solution which may solve your case too.
Use a reverse proxy server like Nginx or Squid to redirect the traffic Apache Tomcat. Both of them can use htpassword for authentication and hence, will serve your need. If you want to use Apache as frontend then backend can be nginx which in turn will redirect to Tomcat after proper authentication. It may have a performance hit, though.
https://www.digitalocean.com/community/tutorials/how-to-set-up-http-authentication-with-nginx-on-ubuntu-12-10