apache configuration for hybris - sap-commerce-cloud

I have one webserver and two hybris servers. For example:
webserver - http://10.0.0.1
Hybris - http://10.0.0.2:9001 and http://10.0.0.3:9001
Now I want to use webserver as a load balancer to redirect the requests. Redirecing is working fine but during redirect it exposes the hybris IP which I dont want. I want to expose the webserver IP to public.
How I can write the redirect rule for that. Any help is highly appreciated.
Thanks,

Basically, you want to have the following in your apache configuration:
<Proxy balancer://cluster>
BalancerMember http://10.0.0.2:9001 route=node1
BalancerMember http://10.0.0.3:9001 route=node2
</Proxy>
ProxyPass / balancer://cluster/
ProxyPassReverse / balancer://cluster/
By using a proxy like this it will be transparent to the user which ip is being served. See more information on how to configure hybris to worh with Apache in the official documentation here.

Related

Apache reverse proxy not loading resources

I've configured proxy reverse with apache 2.4 on a server (ip for example 192.168.1.10) as follows:
ProxyRequests Off
ProxyVia Off
ProxyPreserveHost Off
ProxyPass "/foo/" "http://172.20.0.3/"
ProxyPassReverse "/foo/" "http://172.20.0.3/"
mod_proxy_html is loaded.
Where 172.20.0.3 is a docker container, hosted by the server.
When I browse to 192.168.1.10/foo/ I see on the url bar 192.168.1.10/index.php (index.php is the page I actually would like to browse), but the resources required to load index.php are not found. So I get 404 page not found.
Setting / instead of /foo works, but I need to configure other proxy on the same server too.
This Q/A does not provide solution for my case: Apache ProxyPass not loading Resources
What I'm missing? Thank you

Apache 2.4 - Simple reverse proxy - not working for multiple entries

I referred the below link and configured the proxy.
https://httpd.apache.org/docs/2.4/howto/reverse_proxy.html
When I configure a proxy for a single application as below in Apache 2.4 in the httpd.conf file, the proxy configuration is working fine. I am able to access my application through the proxy server URL.
ProxyPass / http://host1:8888/
ProxyPassReverse / http://host1:8888/
However If I try configure for two application like below, I am not able to access any of the application.
ProxyPass /nifi http://host1:8888/
ProxyPassReverse /nifi http://host1:8888/
ProxyPass /kibana http://host2:5601/
ProxyPassReverse /kibana http://host2:5601/
Not knowing how you try to reach the application makes it difficult to guess what's might be wrong.
I suggest you to change the proxies config as following:
ProxyPass /nifi/ http://host1:8888/
ProxyPassReverse /nifi/ http://host1:8888/
ProxyPass /kibana/ http://host2:5601/
ProxyPassReverse /kibana/ http://host2:5601/
then try to reach the endpoint pointing your browser to http://youdomain/nifi/ and http://youdomain/kibana/ and check the logs for errors.

Sub-domain forwarding with masking via .htaccess

My sub-domain sub.domain.com is forwarding (redirecting) to another.website.com correctly. However, I want to enable masking, meaning that after redirecting I want my sub-domain to show in the address bar rather than the other domain, while still showing the other domain's page content.
What should I put in the .htaccess file in order to perform this action?
Also, note that the .htaccess file is under my domain's file manager in cpanel and not subdomain's (maybe that's a given for you, but bear with my basic knowledge please...).
Should you need any more information do not hesitate to point it out please.
Thanks in advance!!
You should check the mod_proxy module, the ProxyPass directive and ProxyPassReverse directive. Put these directives in config file:
ProxyPass / https://another.website.com
ProxyPassReverse / https://another.website.com

Access JBOSS management console remotely through Apache

I have an environment where the JBOSS server sits on a linux machine and it's services accessed via Apache server running there.
I am not able access the JBOSS console as "http://:/console"
What changes apparently will I have to make in "httpd.conf" to access this url from outside.
The safer way of accessing your JBoss console is through an ssh tunnel.
Execute locally
ssh -L 7990:localhost:9990 username#your.jboss.server -N
and enjoy your remote server's console on your local machine on port 7990.
Opening console port on your web server is also a solution, but less secure one.
Try with:
<Location /console>
ProxyPass http://localhost:9990
ProxyPassReverseCookiePath / /console/
ProxyPassReverseCookieDomain localhost <YOUR PUBLIC IP ADDRESS>
</Location>
<Location /console/>
ProxyPassReverse /
</Location>
ProxyPreserveHost On
The thing with the ProxyPassand ProxyPassReverse directives is that it preserves the domain so you can handle cookies as is on JBoss side without any problems, and that sessions are tracked correctly.
The ProxyPassReverseCookiePath directive rewrites the path string in Set-Cookie headers. If the beginning of the cookie path matches internal-path, the cookie path will be replaced with public-path. And ProxyPassReverseCookieDomain rewrites the domain string in Set-Cookie headers.
See more:
apache httpd JBoss AS 7 admin console proxy
Apache Module mod_proxy

How to use node.js and sockets within my backbone application

This should be a fairly simple question to answer I think.
my node.js server is installed at
/usr/local/bin/node
I have an index.html and server.js files located at
/usr/local/bin
When I run node it works fine. I have installed a chat application which runs at localhost:8888 the main application/website runs at localhost:8000. My backbone files and main site is located on my apache server, for arguments sake say /usr/local/apache/html
How can I move my chat application into the main site so that I can access the chat app through node?
I've currently got two parts of the site working on different ports and I need to integrate the chat part.
Any advice on this would be great.
Thanks in advance :)
You need to setup Apache as a reverse proxy using mod_proxy. This will allow you to redirect requests from one port to another, making your Backbone client application only see one server.
So for instance, if you want your chat client available at www.mysite.com/chat, you would need to first install mod_proxy and then setup your site's conf file as such:
ServerName www.mysite.com
ProxyRequests off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location /chat>
ProxyPassReverse http://localhost:8888/
</Location>
You can read more about mod_proxy here: http://httpd.apache.org/docs/2.2/mod/mod_proxy.html

Resources