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

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.

Related

Laravel SPA (laravel + vuejs + sanctum) deployed in subdomain returns wrong api

I have this problem since several days.
I'm developing a Vuejs/laravel app, using Sanctum as an authenticator. where laravel mainly have the api gestion role, and I've started to deploying it. On Local, everything looks fine, api and auth are working.
On deploy, since my app is binded to be in a subdomain (laravelapp.maindomain with folder path of domain/laravelapp), when i try to access any page (vue-router) instead of domain/laravelapp/login i get domain/login, even if the page itself is looking fine.
If i try to reload the redirected page (domain/page) i have a 404. Also, since every API is pointing to domain/api/link instead of domain/laravelapp/api/link, everything is broken starting with auth.
I've tried modifying .env file, RouteServiceProvider, .htaccess(but i have no knowledge about that).
I also tried to set the subdomain Document Root to domain/laravelapp (it's the first thing i've done), but not only it dosn't work, if I try to print on screen subdomain's root, it returns domain. It's becoming a real issue right now, thank you for any help.
EDIT: I've discovered something. in the main domain there is a Joomla application. The api route contains the Joomla redirect (like, there is a plugin oh the site that changes language automatically, appending /en /it /de given the chosen language). So, in my case, the api is domain/index.php/en/subdomain. I tried again being more specific with document root, with no results, and playing around with .htaccess, but with no success.

Laravel with URL issues

I need help with Laravel.
My website has multiple URLs for the same pages. The URL includes category-subcategory-product but the URL include: double slash category//product or category//subcategory/product and all they link to the same page.
I asked a developer he said not sure but it maybe from route issue-URL not setup correctly.
Has anyone come across with such issue? What's the main problem and how can I fix it quickly?

Axios Vue.js throwing Cors error on Heroku Laravel application

I've got a Laravel app that's hosted on Heroku, currently in staging environment that's password protected. It's accessible via https:// but axios is making requests to http:// and causing a cors error... I've tried adding allow origin headers as middleware on the routes but that doesn't fix the error.
Is there a way to force axios to use https by default? I don't want to pass the full URL to the axios.get()
This doesn't happen on local so could it be something caused by Heroku?
There is a Pull Request on the way that will try to access http/s if the other protocol fails. So it's a matter of time now.
I think the issue is actually related to Heroku but I can't be certain.
The only thing that tells me this is that I moved to an EC2 instance via Laravel Forge and I don't have any problems.
Strangely I also had a couple of files that were being requested without www. And when viewing in browser it forced the css files to the naked domain. What's weird though is other css files loaded with www. And weren't redirected so I think it could also have been a permissions thing.
I solved the file issue by simply changing the file name and the redirect stopped so maybe an overzealous redirect. Either way it was annoying and I think I tried everything so hopefully that information helps somebody else in future.
Cheers

Using a custom domain with a Heroku hosted app

I am trying to point a custom doamin provided by Domain.com to my Heroku app. Everything works well unless I try to enter a direct URL past the normal landing page.
If I go to mycustomdomain.com I get the right landing page and can navigate throughout the site. However, If I go directly to a URL deeper insite the site such as mycustomdomain.com/widgets I get a 404 error. But, if I go to myapp.herokuapp.com/widgets everything works fine.
Another ofdity is that when I go to mycustomdomain.com no matter where I navigate the url is always diaplyed as mycustomdomain.com with nothing ever trailing.
This ended up being an issue with Domain.com's configuration. No matter what I tried I could not get the domain the redirect properly. I switched to GoDaddy and used the exact same configuration and everything worked great.

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