Spring controller redirects to wrong url - spring

I have a little problem with my spring web application. I run my application on VPS with Tomcat. VPS comes with url 24524.vps.com for example. I parked my domain, to redirect domain.com for example to my vps server hostname. And the problem comes here:
All my controllers and pages work with domain.com url. But when I use return "redirect:main"; in my controller, I get redirected to url 24524.vps.com/main and not to domain.com/main.
How to force redirecting to url domain.com/main?

Im not sure if this is the problem but when i use redirect i put a slash in front of the link.
return "redirect:/main";

the problem wanst in spring.... VPS host was 24524.vps.com so thats why spring redirected to 24524.vps.com... I forced my VPS to use domain.com as host and all problems gone.

Related

Angular UI-Router (1.x) Change Host Url

I have a requirement from a client to change the web site Url to a subdomain when they enter the checkout section of the site we are developing for them. For example from www.mysite.com to checkout.mysite.com. We are using UI-Router in HTML5 mode and would like to have the router change the Url to the subdomain instead of going to www.mysite.com/checkout. Does anyone know a way that this can be accomplished? I've also tried using pushState but without success. All of the subdomain suggestions I've tried have not worked. Honestly even if I just put a "fake" url that would work fine too. Changing the Url is more of a visual thing instead of actually redirecting to a subdomain.
After much review I found that this cannot be done because it is a security issue; even switching to a subdomain (which is what I was trying to do) is not allowed.

Routing problems with Laravel 5 on BlueHost Shared Server

I am in the Beta stage of a Laravel 5.0 project using BlueHost as the server. I have not finalised the domain so I am using a temporary address as follows:
IP Address/username
In a normal Laravel project the root URL is the domain name of the website and routing starts from there. However, in this environment, I have to adjust the route.php file. For instance, instead of the familiar
Route::get('/', 'WelcomeController#index');
I've had to do this:
Route::get('/username/', 'WelcomeController#index');
With the usual adjustment in the .htaccess to re-route everything to the public Laravel folder, I can use the temporary address and access the welcome page. However, when I start adding security with the Auth controller, the re-directs don't work. When accessing a secure URL, you are re-directed to IP Address/auth/login instead of IP Address/username/auth/login. In the .htaccess file in the public folder I've added:
RewriteBase /username/
with both slashes, but that doesn't help. Does anyone know how to set up a Laravel project with a secure area, secured by the Auth controller which has a URL that includes a second segment?

Cake PHP redirection

CakePHP redirection of url like *.php
My site is integrated with more than 20 other sites.
They have a url to access my site
Now i rewrite my code in CakePHP .
So i want to redirect the old urls to the corresponding cakePHP page
You may use the routes configuration to add some paths that resolve your current urls sending them to the appropriate action:
http://book.cakephp.org/2.0/en/development/routing.html#routes-configuration
However, I think you should manage that situation directly in your web server whatever it be (apache, nginx, etc).

How can I hide the requests parameters in the URL string?

I'm using the Facebook php sdk to authenticate users from my website. However after successful authentication, the URL goes to:
http://URL/?state={STATE}&code={CODE}
How can I remove the state and the code from showing up?
I'm using Codeigniter and Nginx so .htaccess is not working..
Thank you
rewrite ^(.+)?state=(.+)&code=(.+) www.yoursite.com$1 permanent;

MVC Routing / HostHeader does not work when I use RequireHttps

I'm currently experiencing an issue whereby my MVC site is not responding correctly using IIS 6.
I've setup a url as http://mysite.co.uk which automatically redirects to the correct MVC home page. As the site contains sensitive information I have added the [RequireHttps] attribute to each controller class to automatically redirect the browser to an https url of https://mysite.co.uk which works correctly.
When I access the site as http://www.mysite.co.uk the site correctly redirects to https://www.mysite.co.uk/Default.aspx but it then responds with
Bad Request (Invalid Hostname)
It looks like any time I use www. as part of the url it fails to respond but I have a hostheader setup as www.mysite.co.uk under the IIS website. Is there anything in particular I need to do to make MVC understand the www. part of the url in terms of routing?
Thanks,
Brian.
IIS 6 doesn't add ssl host headers as you think it would. see my article at:
http://completedevelopment.blogspot.com/2009/06/multiple-host-headers-ssl-and-wcf.html

Resources