How to prevent unusual requests in spring boot? [closed] - java

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.

Related

How does netty server supports both Http and Https protocols with a single port? [closed]

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 4 years ago.
Improve this question
As we know,we provide http service listenning at 80 port,https service listenning at 443 port. Why don't we provide two services on one port? What is the specific reason? And how does netty server supports both Http and Https protocols with a single port?
You can do this but I think its a bad idea as both ports are well defined for either http or https. That said if you really want to do this you can detect if SSL is used or not based on the first 5 bytes of a message and then inject the SSL handler on the fly.
Netty itself includes OptionalSslHandler which does exactly this for you:
https://github.com/netty/netty/blob/netty-4.1.32.Final/handler/src/main/java/io/netty/handler/ssl/OptionalSslHandler.java

How to run node.js, Java and PHP application on same server and same port [closed]

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 6 years ago.
Improve this question
How to run node.js, Java and PHP application on same server and same port, I was trying to run but unable to run.
You need some kind of HTTP proxy layer in front of all this, typically Apache httpd or NGinx. From there you can configure different paths to go to different applications if necessary.
The configuration directives vary considerably depending on the solution you're using, but you can have / go through to PHP and /node go through to Node, while /java goes somewhere else entirely. Just make sure your sub-components are using non-conflicting paths so they can all play nicely together or you'll have to do a lot of ugly URL rewriting.
You could use the varnish cache as a load director and set up different back-ends for each of those servers. Then you could parse the incoming urls to redirect to the appropriate application server. You can absolutely run all of those app servers on the same machine, with varnish listening on one port, and all the other services listening on other ports. It would be easy to firewall those services from external access as well.
Running each service on different machines is also entirely possible and easy. We've used this solution numerous times in different environments because Varnish is extremely light-weight, reliable, and does not have the overhead of a web server such as Apache or nginx which, while good options, can be overkill.
You also get the added benefit of the robust caching it provides. Bonus!

Sending new data from Java program to web browsers [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I want to code a java program which must be able to communicate with web browsers (the clients). Sending data / answering requests is not a problem but I also want to send new data to the clients (so that they see it in their browsers without reloading the page).
What ways are there to accomplish that?
Is there any way to listen for new data (with JavaScript)?
i think what you are talking about is server push.
ie server will send data to client without polling from client.
There are various ways to do this one of the best way is through websockets.
you can use many java server available for websockets and have connect client for asynchronous push. while at client normal javascript will be able to receive the message.
What you're trying to do is called Reverse Ajax: Sending data from the server to a JavaScript-Enabled client (as opposed to a Regular Ajax, when the Client is the one that starts the communication). There 's a nice article on DeveloperWorks that can introduce you into the subject.
There are several ways to accomplish Reverse Ajax, and them imply some customization in both Client Side components (i.e JavaScript) and the Server Components (Java in your particular case). As WebServer says, WebSockets is one alternative -although is not supported by all browsers yet- but another viable solution is using Comet. If you're using Tomcat, this link might help you.

How does an application communicate with a webpage/server [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I want for my java application which I have started to develop to 'communicate' with my webpage. However I have no experience with webpages and would like to know how things such as login using user/pass verification works. Any links to tutorials, where to start, and clarification would help me a lot! Thanks :)
Yes,You can use form at client side for send data to server side..
at at server side you can catch data by using getParameter method.
You can communicate via AJAX
You can store data in session.setAttribute('name', name) / session.getAttribute('name')
You can pass some data in GET-parameters (request.getParameter('userID'))
If you want to develop a simple web application with login functionality, you need to know following. You might want to start from
here
Java
Database (RDBMS or NOSQL)
HTTP Servers/ Request / Response
If you have already developed web app providing some service (such as REST services), you can develop a web client using jquery/backbone.js.

proxy server configuration [closed]

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.

Categories

Resources