Jump to content


Photo

[Solved] domain redirects to 127.0.0.1:8080

127.0.0.1:8080 domain redirect

  • Please log in to reply
4 replies to this topic

#1 tujiorg

tujiorg

    Newbie

  • Members
  • 6 posts
  • Gender:Male

Posted 29 November 2019 - 03:16 PM

Hi Team,

 

I have deployed a java war file developed on spring boot and spring security. All URLs are working fine as those URLs are not secured by spring security. But one URL i.e. tujiorg.com/tujiorg/profile which is secured by spring security is redirecting to http://127.0.0.1:8080/tujiorg_tujiorg/login . Can you please help me on it. WAR file is working fine on localhost. URL http://localhost:8080/tujiorg/profile is redirecting to http://localhost:8080/tujiorg/login so user can login.

 

Can you please check from where this 127.0.0.1:8080/tujiorg_tujiorg comes into picture.

 

Thanks and Regards,

Rishabh Kabra

 



#2 wolstech

wolstech

    Rank X Member

  • Root Admin
  • 11,172 posts
  • Gender:Male
  • Location:Pennsylvania

Posted 29 November 2019 - 03:40 PM

So a few things...first, be aware that the folder name tujiorg_tujiorg is the correct name. Our server adds username_ to all war filenames if it's missing before deploying them. Many war files don't like being renamed, so when building your war, be sure to build the war file with the username_ already added to the name.

As for redirecting to localhost, does the war try to assume the domain from the request? Apache acts as a proxy here, and connects to your app on port 8080 to get content. You can also see what happens when your app is accessed directly by using http://tommy.helioho...ujiorg_tujiorg/ to get to it.


Please do not PM me for support. Posting on our forums lets all of us learn.
Do you play Minecraft? | Server Monitors | And the Dumbass of the Decade award goes to...


#3 tujiorg

tujiorg

    Newbie

  • Members
  • 6 posts
  • Gender:Male

Posted 30 November 2019 - 05:00 AM

War is getting context path. I am not much aware about Apache and proxies. I tried to fix it from Java side but nothing worked. Can you please help me on solve it. Can it be possible that Apache sends my domain to application instead of localhost. I have found something on internet but don't know if it will work.

<VirtualHost *:443>
ServerName www.myapp.org
ProxyPass / http://127.0.0.1:8080/
RequestHeader set X-Forwarded-Proto https
RequestHeader set X-Forwarded-Port 443
ProxyPreserveHost On
... (SSL directives omitted for readability)

</VirtualHost>

 

If you think that anything else can be done from server side to fix it please do it and if you know that how to fix it from java side please let me know.

 

And thanks a lot for quick response.



#4 wolstech

wolstech

    Rank X Member

  • Root Admin
  • 11,172 posts
  • Gender:Male
  • Location:Pennsylvania

Posted 30 November 2019 - 05:08 AM

This is a common issue around here, and it's always fixed in the Java code. 99% of the issues are related to not naming the war file with the username_ on it before you deploy it.

 

Other than that, I know people have had issues with the context path before (the way our system works causes it to guess wrong on what this is). I would start by rebuilding your war, naming the output file tujiorg_tujiorg.war. Then upload and deploy that file. That fixes most people's issues with this.

 

If that doesn't help, you'll need to check your code to ensure you're using relative links. You don't want the code to include the domain name when generating links (because it can and will get the domain name wrong, resulting in links to localhost...). If I remember right there's also a way to force the context path by setting an attribute in one of the XML files, but I don't know Java much at all and might be mistaken.


Please do not PM me for support. Posting on our forums lets all of us learn.
Do you play Minecraft? | Server Monitors | And the Dumbass of the Decade award goes to...


#5 tujiorg

tujiorg

    Newbie

  • Members
  • 6 posts
  • Gender:Male

Posted 30 November 2019 - 07:00 AM

Okay. I will try with naming convention for WAR file. Hope, It will get solve soon.

 

Thanks for this information and quick responses.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users