Sitecore Item and media urls with IPs - hyperlink

We have an odd issue with Sitecore in the publishing pipeline. We have some logic that runs during publish pipeline to write data to another system. One of the data attributes that goes through to the new system is URLs for the content and media items.
The urls for items are http://www.example.com/section/abc but urls for media items are going as http://123.456.789.012/~/media/media.ashx. This works fine in our staging and dev environment where the proper urls go through. But in production, the IPs are being sent out for media items. There are no obvious differences in staging and production configs that I can tell.
Any ideas on what might be going on? Any help is appreciated.

Check what is the value of the "Media.MediaLinkServerUrl" setting.
By default it's empty:
<setting name="Media.MediaLinkServerUrl" value="" />
From what I remember, if:
"Media.MediaLinkServerUrl" value is not set
and AlwaysIncludeServerUrl option is used
and there is no HttpContext.Current (which is true when you're in publishing pipeline)
if 1. 2. and 3. are true, Sitecore generates links to media items with the first host name or ip address that site was hit after app pool was recycled.
It means that if you restart your production server and then hit it with local IP addrress just to make sure it's up and running before it's placed back in load balancer (or maybe it's LB which calls the servers using IP address), Sitecore will generate all the media items url with that IP addrress instead of nice host name.
I assume it works in both dev and staging environments, cause you always hit them with the final host name.

Related

Change the domain mautic uses when generating the urls (previews, emails, landing pages)

I have a docker instance of mautic and it works like a charm.
The only issue is that
the urls generated inside emails (eg. Unsubscribe URL)
the preview links of the forms/emails
the landing page urls
are all pointing to the wrong domain name (network IP address of the guest machine)
I'd like to change that to the url of my mautic installation.
I've checked out the settings with no luck and also looked at all the files inside app/config directory.
Can't be sure about doing inside docker, but in the past we have been using reverse proxy and pointing it to the docker instance, also this helped us using more than one instance along with setting up ssl certificate as well. here's one setup example:
https://github.com/stollz/MauticSSLDocker
hope this helps.

Different nginx config for different environments

I have a Rails app hosted in two different servers (both with dokku) for production and staging environments. The first one is hosted in www.mywebsite.com.br and the second one in www.staging.mywebsite.com.br.
We use a SSL certificate in production so I wrote
return 301 https://www.mywebsite.com.br$request_uri;
in my nginx.conf.sigil file so that every path redirects to the https URI. All working fine.
But now when I go to the staging environment, all URIs also redirect me to the https://www.mywebsite.com.br instead of http://www.staging.mywebsite.com.br. It makes sense, since I'm redirecting all requests in that line, but I can't seem to find a solution to configure my nginx.conf.sigil file for those two different needs.
Thanks a lot in advance and happy new year =)
You'll need a slightly separate nginx conf file for each server/environment, substituting in the correct domain name for each. You can see https://serverfault.com/questions/250476/how-to-force-or-redirect-to-ssl-in-nginx for more details and examples.

Accessing decommissioned website in Umbraco

I have a website that we used to access via Umbraco. It was decommissioned on 11/22 to a new site with same name. There is some content we need to retrieve. I was thinking maybe we could access it via IP but that doesn't work. Anyone know how to accomplish this so we can log on to the old site via umbraco without interfering with the new site.
If you log into the server and find the site in IIS, you could set up new bindings on that site, so it responds to decommissioned.mysite.com. Then add a host file entry to your local machine, so decommissioned.mysite.com sends you to your decommissioned site.
When your computer performs a DNS lookup, the host file is the first place it will look. This means you can use the host file to bypass the DNS settings configured for the public. It comes in handy when you have a dev version of a site that isn't ready for the world, yet. On windows you can find the host file at C:\Windows\System32\Drivers\etc\hosts. You will probably need to run your text editor as an administrator to edit the file. This is what host file entries look like:
123.123.123.123 mydomain.com www.mydomain.com
321.321.321.321 www.myotherdomain.com blog.myotherdomain.com

Setting Up a Test Environment For an ASP.NET MVC3 Website

I've been working for a client's website over the past year. I usually test things locally and then deploy straight to the production website. This has caused us some issues lately so I thought I should create a test/staging environment in which we could thoroughly test new features before pushing them into production.
Anyway, we have a VPS hosting account. I usually use remote desktop to manage the website in IIS. So in order to create a test environment, I copy pasted the folder of the production website inside the same directory (so they are both at the same level) and changed the name of the folder. Then I created a new website in IIS and mapped the physical path to the httpdocs folder inside the copied folder. After that, I setup a new application pool which basically has the same settings of the production website's application pool. I also changed the connection string of the test website.
But then when I tried to view the test website, it did not work the way I expected it to do. I keep getting &ReturnUrl=%2f appended to the query string, and the website is stripped out of its styles (the CSS). I remember this used to happen before when we were still using a shared hosting account, but I have no idea how to fix that.
I really do not know what's wrong. I basically have the same exact setup except I'm using a different port and a different database. I even tried running the test website with the application pool of the production website, but that did not work either...
Any suggestions?
looks like permission problem to me, check if your user has correct privileges in the new folder/app pool :)

How to get base URL in Websphere application Server?

I am running my application in WAS6.1. In the same server I have two EAR deployed. One application can be accessed using the URL server.com:port/app1 over http and the other one as server.com:port/app2. In the application1 I am referencing application2 as :
<media-access-proxy
base-url="http://ipaddress:port/app2"
prefetch-base-url=""
mode="mode1"/>
Since this ipaddress is static so everytime I have to change this if I am moving from dev environment to QA and from QA to production. I want to set it such as that is should take the base url by itself. Does WAS has a properties file like was.baseurl which could be placed in place of ipaddress:port? Or something like that?
The schema requires URI so you can't use anything special. However you can use a DNS name which is same for both environments. Use something like http://server:9080/app2 and add server to both servers' hosts file.

Resources