Sunday, April 24, 2011

Proxy Error (502) caused by Tomcat Http Proxy Setting When Using Struts2

In Tomcat (my version is 5.5 +), the default http port is 8080. In your server.xml connector setting, you may have the following line:

The default Catalina connetor setting for HTTP proxy is pointing to port 80.
By doing so, the HttpRequest Object resides in your session will contain two port values:
  • port=8080
  • proxy port = 80
. This may cause problem when Struts2 is in use. If you use Struts2 UrlHelper to generate the current request URL (which you may save the url as last saved location) the url generated will not contain the 8080 port because proxy port is 80 and Struts use the HttpServletRequest.getServerPort() method to get the request port. So if your url was
http://mydomain.com:8080/some.action
The generated url is actually
http://mydomain.com/some.action
If you didn't setup your web server right or you don't have one, the request is going to failed for a 502 (bad gateway) error.
So double check your sever.xml connector setting in Tomcat if you are getting a 502 error.
The simple solution here is to change proxyPort to 8080 (same as your application port).


28 comments :

  1. Replies
    1. Great Article Cyber Security Projects projects for cse Networking Security Projects JavaScript Training in Chennai JavaScript Training in Chennai The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

      Delete
  2. Your security is ensured when you utilize such intermediaries.free mexico proxy

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. If your VPN can allow you to select the authentication key size,https://novavpn.com/blog/yify/ then, you should select a smaller authentication key size to speed up your VPN connection.

    ReplyDelete
  5. There are a lot of blogs and articles out there on this topic, but you have acquired another side of the subject. This is reliable content thank you for sharing it. vpnveteran

    ReplyDelete
  6. Thank you very much for this great post. I read that Post and got it fine and informative. Please share more like that. visita il sito

    ReplyDelete
  7. Your post has those facts which are not accessible from anywhere else. It’s my humble request to u please keep writing such remarkable articles https://allertaprivacy.it

    ReplyDelete
  8. It turns out that even the hottest port has a few places where you can get off the beaten path. Here are some recommendations that will make you feel like you're in the know privacyonline.com.br

    ReplyDelete
  9. Excellent .. Amazing .. I’ll bookmark your blog and take the feeds also…I’m happy to find so many useful info here in the post, we need work out more techniques in this regard, thanks for sharing.  https://prywatnoscwsieci.pl

    ReplyDelete
  10. Just admiring your work and wondering how you managed this blog so well. It’s so remarkable that I can't afford to not go through this valuable information whenever I surf the internet! weneedprivacy

    ReplyDelete
  11. Thanks for posting this info. I just want to let you know that I just check out your site and I find it very interesting and informative. I can't wait to read lots of your posts. internetprivatsphare

    ReplyDelete
  12. To check your IP address. From direction incite enter ipconfig/all (as appeared in the image) you should see an IP Address and a few DNS Server addresses. how to clear cache on ie11

    ReplyDelete
  13. Thanks for this advice! Apart from setting proxy up, you should consider a VPN too. Like polskivpn.pl you can find a lot of solutions suitable for you.

    ReplyDelete
  14. Thanks for sharing this unique information with us. Your post is really awesome. Your blog is really helpful for me..
    Top college in Jaipur|law college|law college in Jaipur|Best law college in Jaipur

    ReplyDelete
  15. Thanks for sharing this unique information with us. Your post is really awesome. Your blog is really helpful for me..
    organic oil
    organic oil in jaipur
    organic cold pressed oils
    ayurvedic oil store in jaipur

    ReplyDelete
  16. It was thinking about whether I could utilize this review on my other site, I will connect it back to your site though.Great Thanks. lesmeilleursvpn.com

    ReplyDelete
  17. Wonderful article, thanks for putting this together! This is obviously one great post. Thanks for the valuable information and insights you have so provided here. meer informatie

    ReplyDelete
  18. TreasureBox is operated by a group of young, passionate, and ambitious people that are working diligently towards the same goal - make your every dollar count, as we believe you deserve something better.
    Check out the best
    laptop table
    shoe storage nz
    outdoor furniture covers nz

    ReplyDelete
  19. We find lots of learning after reading this very useful article . cara menggugurkan hamil

    ReplyDelete
  20. VPS is an adaptable framework which infers that every one of the assets can be arranged when there is a need. windows

    ReplyDelete
  21. I have read your blog its very attractive and impressive. Nice information. It helped me alot.
    Government vacancy
    Govt Jobs
    Sarkari nokri
    latest sarkari vacancy
    Online Form
    latest govt jobs

    ReplyDelete