Configure Apache Web server to use a proxy server - apache

I want to configure Apache web server to use a proxy server, so that all the outbound requests go through this proxy server. Could you please help me how to do this? I tried with Proxifier, but it didn't help me much.

If you need to proxy outbound requests, you can use ProxyRemote from mod_proxy http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxyremote
ProxyRemote * http://ip.of.proxY.host:port

If you're using Apache the simpler way is to define a global variable http_proxy. On RedHat like edit /etc/sysconfig/httpd and adjust these two lines to your environment:
export http_proxy="http://proxy:8080/"
export https_proxy="http://proxy:8080/"

Related

How to setup Apache as reverse proxy for odoo11 in windows server? Is that posiible?

I need to link my subdomain with the Odoo 11 application which is running in windows server. I have been trying this for a while and ending up in finding the solution for ubuntu server. Please help me in understanding this.
Your help will be highly appreciable. Thanks in Advance.
Why Apache? IMO it will be better to use any other reverse proxy than Apache, one more focused on being a reverse proxy like Traefik or Nginx or Caddy just to name a few that seems to live more in 2018 than Apache. Nothing against Apache, just that IMO there are some better tools for doing reverse proxy today
Assuming that the Odoo 11 listen to the default port 8069
So
Open the Apache virtual host configuration file that refer to your virtual host.
in the virtual host add these lines
####Proxy settings####
Define ODOO_11_URL http://localhost:8069
ProxyPreserveHost On
ProxyPass / ${ODOO_11_URL}
ProxyPassReverse / {ODOO_11_URL}
####END Proxy settings####
If needed - Change the url as needed, for example if the url of Odoo 11 is http://localhost:8069/YOUR_URL - so change the line that start with "Define" to your url.

websphere and apache server proxy and rewrite configuration

There are javaEE applications run on WebSphere server.
The thing I wanna do that to configure a http server that takes the request and redirect to my local websphere server.
For example:
This is live Project testProject.com/Otel..
I wanna reach my local project when I insert local.testProject.com/Otel..
The thing I have done so far I can reach my local apache server when I click local.testProject.com just with adding in host file in windows/system32/drivre/etc directory.
The thing I could not do so far. redirecting this incoming request to my apache server to websphere server.
Could you please help me on these. Dont hasitate to ask further questions.
I would be appreciated if you could give me some ideas with just commenting at least.
Good days..
IBM provides a specialty reverse proxy module for Apache called the WebSphere WebServer Plug-in. Its use is described in detail in the websphere documentation.
In simple configurations, you can just configure any server you already have as a reverse proxy.
Load mod_proxy and mod_proxy_http (varies depending on Apache distribution)
Append to your virtual host:
ProxyPreserveHost ON
ProxyPass /otel http://washostname.example.com/otel
# ProxyPassReverse likely not required in your case.
Of course there are thousands of places to read about setting up Apache as a reverse proxy and there are nearly no WebSphere specifics.

reverse proxy apache to localhost server

I've got a web app running on localhost:3000. I also have an apache server. I would like to reverse proxy the apache server so that requests to /mywebapp get forwarded to the server running on localhost:3000.
I currently have the following config at the bottom of my httpd.conf file, but I'm getting a server error when I try to access it:
ProxyPass /mywebapp http://localhost:3000
ProxyPassReverse /mywebapp http://localhost:3000
Edit - further details:
I'm running a jetty server with java -jar myapp.jar. I'd like to forward requests to an apache server listening on :80 to the jetty server.
I've got mod_proxy_http.so and mod_proxy.so enabled.
I can tell the server is running on localhost - it responds to curl with the appropriate http response. So I'm pretty sure the issue is with my apache setup, but I can't think what the problem would be.
Apache conf file in conf.d for reference: http://pastebin.com/vhXwjbQe
And I've got this in my httpd.conf:
Include conf.d/*.conf
It's hard to give a generic answer because every situation is different so here are some debugging questions to ask yourself:
if the protocol and port correct on the internal service, http and 3000.
Is the service actually listening for connections from localhost? is it running in a docker container etc that would require it to be listening on a different interface? You can check for this by looking at the output from mywebapp's logs and see if the request are making it through the proxy.
Do the paths on the internal service include the prefix that is being passed to Apache or does apache need to strip these off. if for instance mywebapp expects the path "/foo/bar" and apache's reverse proxy is sending it with the context path included "/mywebapp/foo/bar" then it will not match any path in mywebapp.

How can I forward websocket request to Apache Tomcat from Apache httpd?

I have server setup like Apache2 + mod_jk + two instances of Tomcat (7.0.33). Now I am using atmosphere with tomcat. Atmosphere with long-polling is working just fine. But now I want to use web sockets as transport protocol in atmosphere. But it seems Apache is unable to forward request to Tomcat and it gives me error
Can't establish a connection to the server at ws://localhost/Myapp/update/?X-Atmosphere-tracking-id=0&X-Atmosphere-Framework=1.1&X-Atmosphere-Transport=websocket&X-Cache-Date=0&Content-Type=application/json.
Since Apache 2.4.6, Apache httpd forwards/proxies websockets
Mod_Jk implies in the translation of the request from the HTTP into AJP/13 protocol which implies that the web server should have some ability to handle/process the request.
You may be better served by using mod_proxy instead to establish the apache-tomcat communication.
Apache doesn't support WebSocket, so you need to use Ningx or HAProxy.
I think you can do it using a module called mod_proxy_wstunnel
https://httpd.apache.org/docs/2.4/mod/mod_proxy_wstunnel.html
I don't think this existed when the question was originally asked. In version 2.4.5 Apache added support for this mod.

Integrating Apache and Restlet server like Apache and Tomcat

I have my Apache http server running on localhost:80 and restlet server on localhost:8182, but I want to configure above combination just like Apache http server and Apache tomcat servlet container can be configured with mod_jk library.
Is it possible?
Do I have to modify code of mod_jk for this purpose.
Please advice!!!
Thanks in advance!!
Ashish
There are two options:
Setting your Restlet server connector with Protocol.AJP (for use with mod_jk or mod_proxy_ajp), which works with the Jetty connector.
Using mod_proxy as a reverse proxy to your Restlet connector (with Protocol.HTTP).
Unable to do this as of now, Using Apache Tomcat only as servlet container.