大网数据广告活动
服务器运维问答

Redirect port 8080 to 80

· 52CE 我爱测

I've a tomcat running along with the apache2 on Amazon AMI. Till now all of my users were accessing my webapp by putting port number 8080 in url and then tomcat does auto-redirection to 8443. But now I want all my users to access…

问题原文

原帖链接 · Vishal Pawale · CC BY-SA 4.0

I've a tomcat running along with the apache2 on Amazon AMI. Till now all of my users were accessing my webapp by putting port number 8080 in url and then tomcat does auto-redirection to 8443.

But now I want all my users to access my app from 80/443, so I've configured ssl on apache to forward all the request on port 80 to 443 and 443 forwards to port 8080. Everything works well.

The problem is all my existing user's browser address bar have port number 8443 in url as an autocomplete and users are almost likely to hit that url only. So I want to put-in configuration that will redirect all 8080/8443 traffic to port 80.

I tried installing iptables-services but could not understand it properly. I also have a doubt whether it will just end up in endless redirection loop, port 8080->80->8080. So please suggest me a way to handle this more appropriately.

已采纳解答

原帖链接 · MLu · CC BY-SA 4.0

You can reconfigure Tomcat to listen on some other port, e.g. 8088 and then configure Apache:

That will solve your redirects as well as makes using SSL mandatory.

Alternatively you can do all the above with AWS Application Load Balancer - it can do the redirects, SSL termination and only the SSL traffic from port 443 pass through to your Tomcat. The added benefit is that you can use Amazon Certificate Manager to manage and renew your SSL certificates.

Hope that helps :)

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-06-24)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。