[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Handle-info] Adding pages to handle server: FastCGI proxy vs. upstream webserver vs. Java implementation



I would encourage you to just have a separate web service for your PHP application -- is there any particular value in having it run in the same process as the handle service?

As you observed, the handle server is not primarily an HTTP service at all.  The handle server's port 2641 TCP and UDP listeners are entirely separate from its HTTP listener and will be used preferentially for handle resolution.  Perhaps you want to serve the Handle HTTP "proxy" interface or the HTTP API ("/api/handles") at the same domain as your PHP application; if that is that case I think the Nginx approach is probably the best.  Possibly we can advise on the authentication/encryption issues you mentioned.  The non-HTTP TCP and UDP listeners shouldn't be a problem here; they just won't be involved in the HTTP setup at all.

I believe it should be possible to set up a Jetty web application the way you want.  I can see in your error.log that the "/php-test" web application context is started, so I am surprised that /php-test/info.php acts as a handle resolution instead of going to whatever the /php-test application is.  But -- if they need to be connected at all -- I still very much suggest pursuing Nginx or a similar service sitting in front of both your PHP application and the handle server's HTTP listener as separate back-ends.

Robert


On Tue, Sep 12, 2023 at 3:28 PM David Pape <d.pape@hzdr.de> wrote:
Dear all,

at our institution, we would like to provide additional landing pages
via our handle server. I.e., a kind of proxy server application that
runs on the handle server outside of the institutions network, and has
access to certain services behind the firewall and can gather
information/static pages from them.

We already have a basic PHP implementation that I wrote before it was
clear that we would use the handle server for this task. Moreover,
no-one in our team is too familiar with Java (apart from little projects
back in university). So we were wondering whether it was possible to use
the PHP application together with the handle.net software.

My first idea was to run both applications behind another web server
(like nginx) but it turned out this isn't trivial due to encryption,
authentication and the handle server using both TCP and UDP. So I
abandoned the idea.

Since Jetty offers a FastCGI proxy library, and the handle manual
explicitly says that the embedded Jetty can be further configured, I
thought it should be possible to embed our PHP application this way. I
dropped a simple PHP script (attachment) into /var/www/html and, guided
by error messages and the Jetty manual, created a jetty.xml config file
(attachment). I also added Jetty's fcgi-server.jar and jetty-proxy.jar
v9.4.15 to the lib/servletContainer directory. Using this configuration,
the server starts up just fine. However, accessing / results in HTTP/404
and /php-test/info.php results in HTTP/400, telling me the handle could
not be resolved. So it seems some of the endpoints/servlets/handlers
(I'm not sure about the Jetty terminology here) were overwritten while
others were not. Please find attached the access and error logs. (Note:
I ran the server locally on port 8443; IP is redacted.) I would be
grateful if someone could help me get this up and running. I tried Stack
Overflow already as this feels more like a general Jetty question that
is not specific to handle.net. However, in typical Stack Overflow
fashion, the only response I received was someone telling me off for
still using Jetty 9 which is EOL. 😄

Finally, there's of course the option to implement our solution in Java.
Though I'm not sure whether this solves the problem.

Thank you in advance and have a great week!

Kind regards
David Pape

--
David Pape

Research Software Engineer
Data Management and HPC Group (FWCC-D)
Computational Science Department (FWCC)
Department of Information Services and Computing (FWC)
Building 312, Room 3
Helmholtz-Zentrum Dresden-Rossendorf e.V.
Bautzner Landstr. 400 | 01328 Dresden | Germany
Phone: +49 - 351 - 260 3808
https://www.hzdr.de

Board of Directors: Prof. Dr. Sebastian M. Schmidt, Dr. Diana Stiller
Company Registration Number VR 1693, Amtsgericht Dresden_______________________________________________
Handle-Info mailing list
Handle-Info@cnri.reston.va.us
http://www.handle.net/mailman/listinfo/handle-info
_______________________________________________
Handle-Info mailing list
Handle-Info@cnri.reston.va.us
http://www.handle.net/mailman/listinfo/handle-info