Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I am assigned to implement (or better configure) a kind of http proxy server. The server should support processes like described below:
-A user opens an URL in his browser which has the following structure: http://:/resource_name
-Proxy server validates the resource name in the URL of the incoming http-request and determines the URL of a web-resource it should forward the original request from the client to
-Proxy server forwards the original request, waits until it gets an answer from the external web-server, and posts it back to the user
I'm working within java, but I wouldn't like to implement a proxy server by myself playing with sockets. Instead I'd like to use an apache http server. Does anybody know if its possible to accomplish such a task on the configuration level using apache http server? If so, how?
Thank you in advance for your answers!
You can do this in Apache using the modules mod_proxy (to proxy your requests forward) and mod_rewrite (to map your external URL to the URL on your application server)
http://httpd.apache.org/docs/2.0/mod/mod_proxy.html
http://httpd.apache.org/docs/current/mod/mod_rewrite.html
Apache is not written in java. Your chances are good with Tomcat or Jetty.
You will need to implement a webapp with a Servlet intercepting all requests and then handle all your custom logic in the Servlet.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
I have a spring boot application run on a server and after some days I saw some unusual requests are coming. Some of the requests are as follows,
HEAD /bin
GET /.env
GET /api
GET /help
GET /vendor/phpunit
GET /phpmyadmin
GET /wp-admin
So is there an option or any solution to not to hit those requests to server or prevent these requests in spring boot?
You can't prevent those calls to reach your application with your application alone. You would need an API Gateway or an HTTP server like Apache. All the requests to your application must go through any of those solutions and you would need to configure the selected one to block such calls.
Spring boot will generally return a 404 for endpoints that are not configured. To prevent those requests from hitting your application you will need to block them using whatever webserver you are using to send the request to your application.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I have a question regarding the Http and FTP. I have already wrote the utility to download the image file from the Server(images are stored on these servers) using FTP protocol. The utility class is getting invoked from the Spring mvc controller. The utility is working fine but is usage of FTP protocol correct in the case or should I rewrite the utility and use the HTTP protocol image downloading? Which protocol will be faster in this case?
There is not particular difference in terms of extra informations passed using HTTP or FTP protocol.
So the choice between the two protocols is not depending on performances.
If you are writing a client you can't decide. You need to use the same protocol of your server (that can be an HTTP server like Apache or an FTP server).
If you are writing a server ask yourself if the clients will be more confortable with HTTP or FTP protocol. If you are developing a web application probably the best will be the HTTP protocol.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I'm developing a Java Desktop application with MySQL Database, I have searched the internet for days, i need to do the following:
(Client) Desktop application for client will have the GUI.
(Server) Tomcat Server With Servlet.
(Database) MySQL Database server.
Client send request for query in servlet, then servlet response to the client with result which will be filled in database.
No SQL Queries, Updates, Inserts, Delete ... etc will be exist on the client side, all will be in the servlets.
Is this the best way to make 3tier application?
Can I use Another idea or technology to achieve this?
I don't want to go for web application.
I need client send request to middle server, which will connect to database & getting the result then send them back to the client without letting the client connect directly to the database.
Note: The client will be used by Multiple users in same LAN.
A web application which is hosted on a server typically uses HTTP as the communication protocol. So if you want to build your GUI using Java then you will be sending http request on user actions and receiving http response which would be translated to updates on the GUI. You should perhaps use a library such as Apache HttpComponents to send/recieve http response. For creating/deploying a servlet web application you can find lots of tutorials. However these days people use MVC frameworks like Spring MVC ,Struts, JSF etc., as a web application framework which helps immensely in developing web applications.
As your requirement is that there should not be any SQL data access related code on your Client side, all the data access will need to be done on server side and your server side should send an accepted data format (xml/json) to your GUI in the http response which you will need to parse (there are many libraries to parse xml/json) and extract information from.
So your GUI will not be doing any resultset handling. It would be done by the server (inside web application) and the web application would send the xml/json response to your GUI request.
The architecture you are trying to develop in typical thin client architecture. You can imagine your Java GUI as a replacement for web browser.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have a Java server application. I Also have a PHP page which displays logs related to the server, both the page and the server share the same database. I want to be able to stop/start the server (which starts from a .bat) through my page.
What is the best and most secure way to accomplish this?
I tried using some functions which are supposed to run files like exec and system but they just didn't work. I think it's because these are disabled on XAMPP.
Obs.: I can't kill the server process, it would left the ports in use.
The Java-based server should expose some kind of admin interface, for example a socket or a Web Service. When it receives a message (which meaning is "shutdown") it starts an orderly shutdown.
As a security measure, the admin interface should only listen on 127.0.0.1.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I want to create web proxy . I googled it and even found some tutorial but those were in PHP.
If somebody is having tutorial of web proxy creation in java then please post it here Or simply let me know what approach should i follow to create web proxy. [ i will be using Tomcat { if that matters for your answer } ]
Thanks
Edit
i guess i was not clear in stating what i require. Actually i am trying to develop a site like 'http://proxyug.com/' .
JSocks is a SOCKS proxy server written in Java.
http://jsocks.sourceforge.net/
Have you tried Java Proxy servlet. It's web proxy such as php or glype, but written in java as a servlet
This is simply the method you'd use to create a proxy server. Not sure exactly why you refer to doing it 'in java' but based on the information below you'll just need to configure the appropriate settings for mod_proxy and would probably be better off asking this question on ServerFault:
From The Apache Tomcat 5.5 Servlet/JSP Container
Proxy Support HOW-TO
Apache 1.3 supports an optional module
(mod_proxy) that configures the web
server to act as a proxy server. This
can be used to forward requests for a
particular web application to a Tomcat
5 instance, without having to
configure a web connector such as
mod_jk.
http://tomcat.apache.org/tomcat-5.5-doc/proxy-howto.html