Openlitespeed 301 Moved Permanently problem - proxy

I have a new Openlitespeed server on Ubuntu, I have 2 domains pointing to the same IP,
I tried to make a multidomain server so that www.domain1.com would point to one website and www.domain2.com to another.
I followed this tutorial.
Now when I go to domain1.com:80 it returns "CERR_CONNECTION_TIMED_OUT" and if I look at the network tab it shows:
and redirects me to http://domain1.com:8080/
If I go to domain2.com:80 it's the same but it redirects me to 8088.
Before that, I was hosting two testing pages on 8080 and 8088, but I changed all the settings and can't find what is causing the redirections... (both websites are wordpress)

I managed to resolve this, something inside WordPress was redirecting.
I re-downloaded new WordPress and now it works.

Related

Using one Laravel app from different domains - building urls issue

I searched for my issue in so many ways, but I don't seem to find the correct case, so I'm asking here.
I have a Laravel app which is installed on a server and everything works correct. The domain is set as HTTP only and is configured from AWS. However we need to have another domain which should work only from HTTPS. The HTTP domain is pointing to the server instance and the HTTPS one is pointing to a CloudFront distribution with origin the HTTP domain. The issue is that when I open the HTTPS domain, all of the links and images are loaded from the HTTP domain.
To be more concrete, let's say I have http://mysite-notsecure.example.com and https://mysite-secure.example.com.
When I open http://mysite-notsecure.example.com everything works as it should and there are no issues. However when I open https://mysite-secure.example.com the site loads, also files like app.js and app.css load with the correct host, but things like fonts, images, links, etc, load from http://mysite-notsecure.example.com.
Because most of the urls are built with the url() function, I think the issue has something to do with APP_URL, which was first set to http://mysite-notsecure.example.com, but when I added the new domain, I set it to empty (APP_URL=),
however the urls are still built the same way (I cleared config cache).
What should I do in order for my site to build the urls according to the current host?
I don't need any other change for the two domains. They should load everything exactly the same, only the host should remain and not redirect to the other domain.
It turned out there were two different issues.
I'll describe them here, because there is a slight chance someone could be dealing with one of them.
First, I printed the contents of the $_SERVER variable on both domains and the host in both was the same - the HTTP domain.
This issue was from the CloudFront configuration. Turned out the Host header was removed from the CF distribution behavior, so that CF replaced it with the origin's value (the origin is the http domain). After this was fixed, the host in $_SERVER appeared correctly.
But the initial issue for the urls building was something else which I didn't think of. After clearing the cache to remove the debugging and seeing the right urls on the HTTPS domain, I switched back to the HTTP one and saw now there all the urls pointed to the HTTPS domain. That is when it hit me that these domains share not only the configuration, but also the cache. And most of my urls on the page I was testing with, were coming from a function with cache, so when the cache was stored from one of the domains, they appeared the same on the other. When I included the host in the cache key, everything worked correctly.
Hope this helps someone else.
goto file .env and setup the APP_URL=https://mysite-secure.example.com/ and change
href={{asset('folder-path')}} in layout or blades file

website on Azure not Accessible due to www coming before websitename azurwebsites net

I have uploaded a Magento website to Azure website. It was working perfectly fine with websitename.azurewebsites.net
But when i tried to use a custom domain(I did the dns thing also). Whenever i go to the custom domain or with .azurewebsites.net it redirects to www.websitename.azurewebsites.net
Why is the www coming before websitename.azurewebsites.net ?
You configured your DNS with CNAME
www.websitename.azurewebsites.net
Check the guide you followed for DNS configuration and make sure "www" in the front is removed.

Laravel forge replacing seccond site

I am using laravel forge and it's awesome. However i ran into one problem.
I created a server on digital ocean and referred my domains to that ip. Everything good and well so far.
Than i created a site. Used the deployer and yup everything worked like a charm, however now i added a second site to the server. and well yes it added the site. so /home/forge/website2.com. However now when going to my previous site: website1.com it shows me website2.com.. i rebooted the server, reloaded nginx nothing seems to work als in sites_available the paths look good.
Any idea's?
Are site 1 and site 2 on different domains, or are they just different sub domains?
Have you tried comparing the Nginx configuration (you can get to it from the Forge site) between the two websites?
To me it seems that your Nginx configuration is wrong. Lastly, are either of them stored on the "default" site on forge or did you qualify a url and keep "default" empty?
This issue has been resolved by taylor, He updated forge and this isn't a problem anymore.

xampp - no longer loads local website but always redirects to internet version of site

I have a website that is live and a version that I am working on locally using XAMPP. For some reason every time I try to load:
http://localhost/websitename
or
http://127.0.0.1/websitename
it goes to the internet version. This has only started happening. All services are started. XAMPP is working for all other sites that I am working on locally.
Check your site settings as I believe you're having the url in your website set to the live version.
This can have alot of reasons.
What does your windows host file have for redirect rules (C:/Windows/system32/drivers/etc/host) I assume that you use Windows because you said "xampp", correct me if im wrong)
Check for header(); redirects within your websites php scripts.
Do you have a v-host entry redirecting you to another url in your v-host config of your apache?
Check if you have any hard-coded url's? or redirects? in the project that are redirecting to the live version.

Routing a url to fetch content from another site

Environment: IIS 7.
I have a default site www.domain.com. Folder C:Inetpub/wwwroot/domain
There is subdomain www.subdomain.domain.com. Folder C:Inetpub/wwwroot/domain/subdomain.
Now, I have set up a new website at an external server, say www.newdomain.com. I cannot host www.newdomain.com on the same IIS server (as mentioned above) due to some constraints.
In this setup, how do I get www.subdomain.domain.com/blog to show all the content available on www.newdomain.com while preserving the URL as www.subdomain.domain.com/blog
How could this be achieved in IIS 7?
You would have to put the entire www.subdomain.domain.com on the other server. You can't put just the /blog path somewhere else.
How would any client know to go to that other server for /blog if the DNS for the subdomain points to the first server?
Alternatively, you could create blog.subdomain.domain.com for the blog server.
Possible approaches:
Host the new website as blog.domain.com with the actual content hosted on a different server (not the same IIS server as domain.com)
Set-up a ProxyPass on subdomain.domain.com/blog to the new website. I know how do to this on Apache (via mod_proxy and ProxyPass), but not sure how to do this with IIS. Probably ARR can help you.
I was finally able to do this by reverse proxy rewrite rule. For those who have similar trouble here is the solution:
Go to the site node hosting www.subdomain.domain.com and click rewrite rule. If ARR is not installed the IIS Manager will ask you to install it. After installing ARR close and reopen the IIS Manager.
Open the rewrite rule window. There will be a dialog asking to allow reverse proxy to servers outside your server farm, accept that. In the Inbound rule enter www.newdomain.com. In the from input of the Outbound rule enter www.newdomain.com and in the to input enter www.subdomain.domain.com. click apply changes.
This will route the entire www.subdomain.domain.com to newdomain.com. What you need is to route only the /blog link.
To do this go to rewrite rules and select the rewrite rule you just created. Click edit and in the match section in url input change (.asterix) to ^blog(.asterix). This will apply the rule to route only the /blog.
That all. test your routing in the browser, if everythings fine this should work.

Resources