Mule outbound HTTP endpoints via proxy - java

I have a mule application deployed on linux (RHEL 6) box which talks to twilio API and Gmail API. The server where the mule application is deployed has to go out via proxy.
I have modified /usr/local/mule-standalone-3.5.0/conf/wrapper.conf and added additional java property for proxy settings (using wrapper.java.additional.4)
and when I search the mule process, here is what I see
$ ps -ef | grep mule
root 12940 12938 0 Dec04 ? 00:04:24 java -Dmule.home=/usr/local/mule-standalone-3.5.0 -Dmule.base=/usr/local/mule-standalone-3.5.0 -Djava.net.preferIPv4Stack=TRUE **-Dhttp.proxyHost=http://<proxy> -Dhttp.proxyPort=80 -Dhttps.proxyHost=http://<proxy> -Dhttps.proxyPort=80**
I still am not able to hit the outbound HTTP/ HTTPS urls.
Is there a different way of setting outbound proxy in mule?

Please try configuring the proxy in the connector.

Related

Quarkus / Restclient with proxy configuration

I am using quarkus 1.10.5.Final and need to call web service with web proxy.
Currently my code using microprofile client proxy and put below configuration in application.properties
client/mp-rest/url=https://remote.com
client/mp-rest/scope=javax.inject.Dependent
client/mp-rest/trustStore=classpath:/META-INF/resources/cacerts
client/mp-rest/connectTimeout=5000
client/mp-rest/readTimeout=5000
client/mp-rest/followRedirects=true
client/mp-rest/proxyAddress=http://proxy:8080
but still resulting RESTEASY004655: Unable to invoke request: java.net.UnknownHostException: No such host is known
I tried to use -Dhttp.proxyHost and -Dhttp.proxyPort to test the proxy and it was success.
the problem is I can't use -Dparams since it will break other service calls.
this link where I got config for mp-rest/proxyAddress
https://download.eclipse.org/microprofile/microprofile-rest-client-2.0-RC2/microprofile-rest-client-2.0-RC2.html
but its not mentioned in https://docs.jboss.org/resteasy/docs/4.1.1.Final/userguide/html/MicroProfile_Rest_Client.html
please let me know if I am looking on wrong thing.
May 2021 update
Quarkus 2.0 supports MicroProfile Rest Client 2.0. With it you can use the configuration you mention, namely
# A string value in the form of <proxyHost>:<proxyPort> that specifies the
# HTTP proxy server hostname (or IP address) and port for requests of
# this client to use.
client/mp-rest/proxyAddress=host:port
Or set it programmatically with
ProxiedClient client = RestClientBuilder.newBuilder()
.baseUri(someUri)
.proxyAddress("myproxy.mycompany.com", 8080)
.build(ProxiedClient.class);
Original answer
You should be able to set proxy for your Quarkus Rest client with the following properties:
org.jboss.resteasy.jaxrs.client.proxy.host
org.jboss.resteasy.jaxrs.client.proxy.port
org.jboss.resteasy.jaxrs.client.proxy.scheme
I just run into the same problem and found this issue.
Upgrade to MP Rest Client 2.0 #10520
MP-Rest-Client 2.0 is not available in quarkus 1.10.5.

Still cant access localhost:5762 after starting RabbitMQ server

Tried accessing the RabbitMQ management page on localhost:5672 and the connection is being refused. I have reinstalled RabbitMQ via Homebrew and still running into the same problem. I ran rabbitmq-server after the reinstallation and got back this prompt:
## ## RabbitMQ 3.8.1
## ##
########## Copyright (c) 2007-2019 Pivotal Software, Inc.
###### ##
########## Licensed under the MPL 1.1. Website: https://rabbitmq.com
Doc guides: https://rabbitmq.com/documentation.html
Support: https://rabbitmq.com/contact.html
Tutorials: https://rabbitmq.com/getstarted.html
Monitoring: https://rabbitmq.com/monitoring.html
Logs: /usr/local/var/log/rabbitmq/rabbit#localhost.log
/usr/local/var/log/rabbitmq/rabbit#localhost_upgrade.log
Config file(s): (none)
Starting broker... completed with 6 plugins.
Not sure why I cant access the management page via the default port. I had a few applications using RabbitMQ running and none of them are working now. What is the best way to completely uninstall RabbitMQ from a Mac so that I can run a clean install?
I think you should have to enable management plugin as stated in rabbitmq documention:
The management plugin is included in the RabbitMQ distribution. Like any other plugin, it must be enabled before it can be used.
Just go to your rabbitmq installation directory (example path /usr/save/rabbitmq_server-x.x.x/sbin) and run following command:
rabbitmq-plugins enable rabbitmq_management
After this if rabbitmq management still not accessible try to stop and restart rabbitmq server.
Here are reference link:
Rabbitmq documention on management plugin
Rabbitmq different networking ports information
To answer these:
Not sure why I cant access the management page via the default port.
Still cant access localhost:5762 after starting RabbitMQ server
If the rabbitmqctl status / rabbitmq-diagnostics status command shows a listener like this:
Interface: [::], port: 15672, protocol: http, purpose: HTTP API
then RabbitMQ might be setup correctly.
Probable cause: Http redirection
The issue might rather be with the URL that's visited. Chrome could be set to redirect HTTP to HTTPS. If this is so, and you don't have an HTTPS listener setup, you'd see a ERR_SSL_PROTOCOL_ERROR.
To get around this, you can disable redirection on Chrome only for localhost. By doing so, http://localhost:15672 will no longer be redirected to https://localhost:15672 and the management web client will therefore be visible.
How to disable HTTP redirection for a domain in Chrome
Visit chrome://net-internals/#hsts
Delete domain security policies for the domain (in this case simply enter localhost)
Click the Delete button

Glassfish 4.1 configure http/https proxy

To access external endpoints I have to go through proxy server. I have been trying to configure the http and https proxy in my glassfish 4.1 server but have had no success. I've tried adding the following sets of Java Options in my domain.xml - manually and through UI. But am still getting "Network is unreachable; nested exception is java.net.SocketException:
Network is unreachable" error.
<jvm-options>-Djava.http.proxyHost=proxy.domain.com</jvm-options>
<jvm-options>-Djava.http.proxyPort=3128</jvm-options>
<jvm-options>-Djava.https.proxyHost=proxy.domain.com</jvm-options>
<jvm-options>-Djava.https.proxyPort=3128</jvm-options>
**********************************************************************
<jvm-options>-Dhttp.proxyHost=proxy.domain.com</jvm-options>
<jvm-options>-Dhttp.proxyPort=3128</jvm-options>
<jvm-options>-Dhttps.proxyHost=proxy.domain.com</jvm-options>
<jvm-options>-Dhttps.proxyPort=3128</jvm-options>
When I check the process (ps -ef | grep java) I can see the Java Options have been applied. I also need to implement http.nonProxyHosts ( something like -Dhttp.nonProxyHosts= *.mydomain.com|localhost ) since some are internal endpoints and need to escape the proxy. But that's the second battle. Any help on this would be very much appreciated.
https://docs.oracle.com/javase/8/docs/technotes/guides/net/proxies.html

Starting a bootRun process on port 80 as non-root user with Spring

I'm trying to use Port 80 as a non-root user and I've seen the discussions about using IP Tables but I'd like to use the tomcat configuration files to be able to modify these bindings. There is an option for AUTHBIND that allows using ports <1024 but I have no idea where the Spring tomcat files are located... There is no tomcat service running when I start my Spring process so where is the Spring tomcat server actually located? Where can I see the configuration files etc?
I think you have a wrong approach. I don't recommand you to try to use HTTP port 80 directly.
A good practice is to use Apache HTTP Server redirection or alias :
Here's a tutorial
Explaination :
You will start your Tomcat with "classic" port (such as 8080 or 9080 or anything else over 1024). Then, you will configure your Apache server to redirect HTTP request from HTTP port 80 to your Tomcat server.
Do follow steps:
1. Go to your application.properties if it doesn't exist.
2. Create a application.properties inside src/main/resources folder.
example->/src/main/resources/application.properties
3. Simply add this property server.port = 80 or if you want it to be random do server.port = 0

How to activate SSL(HTTPS) in Glassfish 3.0 embedded API?

We are implementing an application with a webservice as component and decided to use the Glassfish 3.0 embedded distri to provide the webservice. And it works.
We need a SSL(HTTPS) connection to the webservice, but we didn't find any documentation or hint how to activate it programmatically via the embedded API.
Thus we tried to configure the embedded Glassfish via domain.xml, what has a listener configured with SSL. And the port is reachable but only without SSL. The embedded Glassfish seem to ignore the configuration to activate SSL for the port.
Has anyone experience in configuring embedded Glassfish with SSL?
Ok,
sorry that it took so much time for my answer.
The programmatical embedded API seems not to porvide a way to do this task.
Except to run an asadmin command:
logger.debug("Configure port for SSL");
String command = "create-http-listener";
ParameterMap params = new ParameterMap();
params.add("listeneraddress", "0.0.0.0");
params.add("listenerport", "443");
params.add("defaultvs", "server");
params.add("securityenabled", "true");
params.add("enabled", "true");
params.add("DEFAULT", "http-listener2");
CommandRunner runner = server.getHabitat().getComponent(CommandRunner.class);
ActionReport report = server.getHabitat().getComponent(ActionReport.class);
runner.getCommandInvocation(command, report).parameters(params).execute();
Running this code is simmlar to execute:
asadmin create-http-listener --listeneraddress 0.0.0.0 --listenerport 443 --defaultvs server securityenabled=true --enabled=true http-listener2
But this solution creates a new port with SSL. Reconfigure the already started port would be a nice option.

Categories