Using Restlet with Apache2 - servlets

I'm a newbie here..I'm trying to build a simple single page web application
for now I am using apache 2 http server to serve the front end stuff(html/js/css/imgs..)
and using a jar that uses Restlet2.0 on port 8015 to provide APIS for Ajax calls from the front end
now because Apache is using port 80 and Restlet is using port 8015, I have to use absolute address in my ajax calls where all cross-domain hell breaks lose
I'm wondering how do I make Apache 2 work with Restlet? I've been googling a lot and there has not been many useful results. How can I forward all the API calls to Restlet, and still taking advantage of the nice apache 2 features

You might want to setup a reverse HTTP proxy with Apache HTTPd (recommended).
An alternative is to use the AJP protocol as Restlet supports it through its Jetty extension.
http://httpd.apache.org/docs/2.2/mod/mod_proxy_ajp.html

Related

.Net 6 API - can't get data -> ERR_CERT_AUTHORITY_INVALID

I run a .Net 6 API on my Raspberry PI. I can get data from this API using the browser “https://192.168.178.51:7001/swagger/” . Also getting data from entering the url “https://192.168.178.51:7001/api/status/” returns the expected values. So the API is working so far. But when I try to get data from my Blazor WASM App using HTTPClient I get no data. Inspect the browser shows the following message:
GET https://192.168.178.51:7001/api/Status net::ERR_CERT_AUTHORITY_INVALID
How can I fix this? Do I have to install a SSL Certificate? How to do this for a self contained API?
You will need, at minima, a self-sign certificate. Then you will need to let your browser accept a self-sign.(Advance, Proceed to ServerIp)
Now, I do not know what OS you are using in your Raspberry, but for a Beaglebone(similar to Raspberry Pi) with Debian and nginx, here is the procedure
https://www.digitalocean.com/community/tutorials/how-to-create-a-self-signed-ssl-certificate-for-nginx-on-debian-10
You will need the same kind of steps for which ever OS and webserver(Apache, nginx...Kestrel?).
Using a reverse proxy will be the solution, as described here: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-nginx?view=aspnetcore-6.0
Quote from the article:
Kestrel is great for serving dynamic content from ASP.NET Core. However, the web serving capabilities aren't as feature rich as servers such as IIS, Apache, or Nginx. A reverse proxy server can offload work such as serving static content, caching requests, compressing requests, and HTTPS termination from the HTTP server.
Using a reverse proxy I can set a certificate.

Running Kestrel with http/2

I need to support http/2 on my web app running inside a container and I'm having a hard time to configure Kestrel to run http/2 with my self-signed certificates.
What I want to ask is, is there a difference running Kestrel behind Nginx and handling all http/2 communication on Nginx and supporting http/2 at Kestrel level?
To summarize there are two options:
1. Run Asp.Net Core app behind Nginx and on http. Http/2 is handled by Nginx.
2. Run Asp.Net Core with http/2 support.
Which way should I prefer?
For any production environment, it is better to use a dedicated reverse proxy (like Nginx) instead of exposing the application directly. They are more specialized for this purpose and usually provide better security and performance. ASP.NET Core documentation also recommends using separate reverse proxy for these reasons https://learn.microsoft.com/en-US/aspnet/core/fundamentals/servers/kestrel?view=aspnetcore-3.1

Is is possible to have http service using cxf without tomcat

I am writing a server which is used to provide service using http protocol. (The server is not designed to be accessed from broswer, it's used to provide data for iphone client) I know cxf library has good support for this. Is it possible to do this without tomcat.
If possible, a sample project or sample config file would be great.
(I think the question could also be understood as do we have to use the web container like tomcat for http protocal)
Thanks
You don't need to use tomcat. CXF has an HTTP transport that uses an embedded Jetty instance to provide HTTP server support for the case where you don't use Tomcat or other servlet engine. Almost all of the sample applications that CXF ships in the samples directory use this when you use the -Pserver maven profile.

Whats the best Http Component which supports SOCKS and HTTPS for C#.NET

Iam coding an application which needs to do some web automation to some websites from our intranet. Some are simple web services while some will be https websites. My application needs to connect to them via socks proxies.
Now httpwebrequest class does not support socks so Iam looking to code a complete HTTP wrapper using Sockets . I need suggestions from my fellow coders here on what would be a good component to use as I am not looking to re invent the wheel here, rather use some existing socket based solution, either opensource or paid components.
Any suggestions guys? I need only socket based components which support socks proxies.
SecureBlackbox includes HTTP / HTTPS components that support both HTTP proxy, HTTPS proxy and SOCKS. The components use their own socket class which can be used separately as well.

Configuring LCDS HTTPProxy service behind a firewall

I have an LCDS server sitting behind a corporate proxy/firewall.
I need to use a configured HTTPProxyService on the LCDS server to make requests out to beyond the firewall (can't go directly from the client because of crossdomain.xml issues)
How do I configure LCDS to use the corporate proxy on it's outbound requests?
Docs ftw:
http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/lcds/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=rpc_config_4.html
Use the <external-proxy /> tag.
LCDS is using Apache HTTP client in order to establish a connection through an external proxy. All the parameters from the tag are going to be used in order to initialize an org.apache.commons.httpclient.UsernamePasswordCredentials instance (or NTCredentials).
I think that first it's easier if you build a standalone java application using HTTP client to use your corporate proxy (easier from a testing point of view), and after you succeed to find all the settings you can add them into proxy-service.xml (I can help you with that).

Resources