0

I have my spring web application which I can run with tomcat. My problem is, that I need to send all requests from application to different port that my tomcat is running on. Now tomcat is running on localhost:8080 and I want to send all request from my web application to different port for example localhost:8081. Can you give me some advice or is that even possible?

Want to change Request URL from Actual Request URL (image) to this: http://localhost:8081/pa165/lecture/list

  • 1
    Why not just use a location header? Do you control both applications? I'm confused about what the issue here is – Zachary Craig Mar 25 '19 at 17:48
  • 1
    See for port forwarding options for your OS if you really want to do so. Otherwise configure your application to use port 8081. – James Jithin Mar 25 '19 at 17:57

2 Answers2

1

Simply document that 8081 is the port to connect to, just as you would have had to document that 8080 was the port to connect to.

If you didn't document that somewhere somehow for port 8080, how would any user/client know where to go ? Ditto if your port is any other.

Erwin Smout
  • 17,245
  • 4
  • 28
  • 49
0

Based on the correct answer of this question How to change tomcat port number

You need to:

  1. Go to tomcat>conf folder
  2. Edit server.xml
  3. Search "Connector port"
  4. Replace "8080" by your port number
  5. Restart tomcat server.
Vithor Escames
  • 96
  • 2
  • 13
  • I find out that I am using tomcat plugin [look at image](https://prnt.sc/n3901u) and I know how to change port on which my tomcat is running, but I still can't fing out how to change the port for requests. – viktor slany Mar 26 '19 at 17:33
  • I saw you want to send requests to localhost:8081, do you have an API running or what? – Vithor Escames Mar 26 '19 at 19:32