When I load the url for a rather large application I'm working on, I'd say every 3-4th reload the application hangs and stops loading. Chrome reports "sending request" in the lower left. I can't seem to identify any file its stopping up on, but instead found this thread:
https://code.google.com/p/chromium/issues/detail?id=55046
which indicates it might be a socket issue. Flushing sockets from this page (chrome://net-internals/#sockets) instantly frees up the page and everything proceeds to load normally. Here's an image from that chrome internals page
I realize that this may indeed be a chrome bug, but in the meantime, I need a workaround, since users are hitting this bug in chrome, and can't load the application.
Ideas?
I know of 2 workarounds, none are exactly convenient though:
Disable SPDY: "...\chrome.exe" --use-spdy=off (unfortunately cannot be done via flags)
Disable Sync ("Settings - Disconnect your Google Account")
Another option is to reduce number of connections within your app (serve all static content from 1 domain + 1 websocket connection for all client-server communication), and remove widgets (twitter, disqus, etc which keep persistent connections) where possible, which may or may not help considering the socket pool is shared between all Chrome tabs :(
Personally for me this bug occurs to random websites since Chrome 21, and is somewhat countered by crashes which reset the pool :)
After your suggestion about the images being redirecting and by using Fiddler2 I saw that I also had a lot of redirects in images.
In my case, I have a rewrite rule in ASP.NET MVC that lowercases our URLs. This was also the case for our projects folders, in this case, the one that contains the images, e.g. URL/Images/OurLogo.png became url/images/ourlogo.png.
Changing our rewrite rule to include the following line in the conditions tag, solved the issue:
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
Full rewrite rule for reference:
<rule name="Convert to lower case" stopProcessing="true">
<match url=".*[A-Z].*" ignoreCase="false" />
<conditions>
<add input="{REQUEST_METHOD}" matchType="Pattern" pattern="GET" ignoreCase="false" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Redirect" url="{ToLower:{R:0}}" redirectType="Permanent" />
</rule>
Related
Sorry if I'm totally confused and barking up the wrong tree here!
I know that on an Apache server I can set up a .htaccess file and use Redirect to, well, redirect a specific url to a specific new url
Redirect /olddirectory/oldfile.html /newdirectory/newfile.html
Is there a similar function/ability for IIS servers? I don't know a huge amount about the setup other than IIS & asp.net, but am trying to point the IT guys in the right direction, ie: not using a meta refresh/redirect!! I can find out more info if required.
You need to follow this steps:
1) Install IIS URL rewrite module to your server if not installed https://www.iis.net/downloads/microsoft/url-rewrite
2) In web.config of your website add this rule:
<rule name="redirect1" enabled="true" stopProcessing="true">
<match url="olddirectory/oldfile.html" />
<action type="Redirect" url="/newdirectory/newfile.html" />
</rule>
Then you will receive redirect from /olddirectory/oldfile.html to /newdirectory/newfile.html
Using the 301 Redirect Module for Sitecore 7, I'm having a problem establishing the proper Requested Expression and Source values to use in the Sitecore Redirect Module. I have an example url that is typically getting request that I want redirected to the home page of the site.
The example url requests all contain excite.com at the end of the URL:
https://www.example.com/products/foods/apples/excite.com
https://www.example.com/products/foods/oranges/excite.com
https://www.example.com/products/foods/pears/excite.com
I would like these requests that contain excite.com at the end to be redirected to the home page (https://www.example.com) but I can't for the life of me figure this out.
I haven't used the 301 Redirect Module but have used similar modules. There are 2 issues that need resolving.
You need to create a redirect using the Pattern Match Redirect. The regex you need is "match any request that ends with /excite.com"
.*(/excite.com)$
The other issue is that Sitecore is seeing the .com part of the url as an extension and then filtering the request. You need to add com to the list of Allowed extensions.
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<preprocessRequest>
<processor type="Sitecore.Pipelines.PreprocessRequest.FilterUrlExtensions, Sitecore.Kernel">
<param desc="Allowed extensions (comma separated)">aspx, ashx, asmx, com</param>
</processor>
</preprocessRequest>
</pipelines>
</sitecore>
</configuration>
All that said, if you are using the IIS Rewrite module then you could just add a rule in there which will get resolved and redirect before you even hit the Sitecore pipelines and therefore you do not need to worry about the allowed extensions filter.
<rules>
<rule name="Redirect excite.com" stopProcessing="true">
<match url=".*(/excite.com)$" />
<action type="Redirect" url="https://{HTTP_HOST}" appendQueryString="false" />
</rule>
</rules>
Change the regex to (excite.com)$|.*(/excite.com)$ if you also want it to match http://ww.example.com/excite.com
I have read through NWebSec's documentation to try and resolve the problem.
Set the web.config to
<nwebsec>
<httpHeaderSecurityModule
xsi:noNamespaceSchemaLocation="NWebsecConfig/HttpHeaderSecurityModuleConfig.xsd"
xmlns="http://nwebsec.com/HttpHeaderSecurityModuleConfig.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<redirectValidation enabled="false">
<allowSameHostRedirectsToHttps enabled="false"/>
<add allowedDestination="https://www.facebook.com/"/>
<add allowedDestination="http://www.nwebsec.com/"/>
<add allowedDestination="https://www.google.com/accounts/"/>
</redirectValidation>
<securityHttpHeaders>
<strict-Transport-Security max-age="365" includeSubdomains="true" httpsOnly="false" preload="true" />
</securityHttpHeaders>
</httpHeaderSecurityModule>
but I am still getting
A potentially dangerous redirect was detected. Add the destination to the whitelist in configuration if the redirect was intended. Offending redirect: https://www.facebook.com/dialog/oauth?response_type=code&
This came up in google before the answer, which is here: https://docs.nwebsec.com/en/latest/nwebsec/Redirect-validation.html
In summary you have to whitelist the URL which your login service refers to, like this:
app.UseRedirectValidation(opts =>
{
opts.AllowedDestinations( "https://www.facebook.com/dialog/oauth");
opts.AllowedDestinations("https://login.microsoftonline.com"); // Tested
});
We are releasing a new version of our Web app and in the process doing a branding change with a new domain also.
Both our apps are hosted in Azure.
Current App - Cloud Service
New App - Azure Website
What I want to achieve is redirect any old links from the old domain to the new domain while keeping the url portion.
Example:
User visits
https://my.currentdomain.com/any/link
and will be directed to
https://my.newdomain.io/any/link
Do I do a CNAME from currentdomain to newdomain and then a URL Rewrite in my web.config??
Thanks!
Update - I've test this locally and it does what I'm looking for. I'll just point the cname of the old domain to the new domain and this redirect should pick up the links.
<rule name="Redirect to new domain" stopProcessing="true">
<match url="^(.*)$" />
<conditions>
<add input="{HTTP_HOST}" matchType="Pattern" pattern="^olddomain(:\d+)?$" />
</conditions>
<action type="Redirect" url="https://my.newdomain.io/{R:1}" redirectType="Permanent" />
</rule>
The fact that you host your application in Azure has minimal to no impact on the solution you are going to find.
When you do such things, you usually want to also keep all the credits that you have in the search engines. And you can only achieve that if your https://my.current.domain.com/any/link does a HTTP 301 Redirect Permanent to the new location.
Depending on the size and complexity of your project this can be a trivial task or not so easy.
One option, which is valid only if you want to redirect few (like a dozen) links. You can do that directly in your Web.Config file:
<location path="any/link">
<system.webServer>
<httpRedirect enabled="true" destination="https://my.newdomain.io/any/link" httpResponseStatus="Permanent" />
</system.webServer>
</location>
This of course makes no sense when you have a bunch of links, or even a whole CMS behind the scenes. If this is the case, I would opt-in for writing a custom HTTP Module for IIS. This module will have the sole purpose of inspecting the incoming URI and either let it further, or generate HTTP 301 redirect.
If you are using the latest and the greatest from Microsoft, the same (custom HTTP Module) can be achieved with a custom OWIN Middleware.
If it is just domain change, all paths and query strings are to be kept, check out this good article how can you do this with URL Rewrite under IIS.
add this code to your header file:
<script type="text/javascript">
// Get Current URL
var url = window.location.href;
// Replace domain in URL
var newurl = url.replace("olddomain.com", "newdomain.com");
// Redirect to new URL
document.location = newurl;
</script>
I've got an azure website (at http://ekpowestore.azurewebsites.net/) that won't show a Facebook like button in Explorer or Firefox. It does in Chrome and Safari. Yet if I change the address to https (as in https://ekpowestore.azurewebsites.net/), the Like and Share buttons render just fine.
Liking an https isn't the same as http. I guess I can refer folks to the https site, but I'm still curious about what the root cause is.
Of course, I tried about 100 different things before finally throwing up a nearly empty page on my azure site.
seems your page returns 307 "Internal Redirect" while trying to load the Facebook script on HTTP request. I am not sure, but you possibly used "Protocol relative" referencing on your javascript like
js.src = "//connect.facebook.net/en_US/sdk.js";
which will redirect the action with using the current protocol (https://connect.facebook.... if you are using HTTPS or to HTTP). Could you please try to replace it with full url to give it a try ?
eg.
js.src = "https://connect.facebook.net/en_US/sdk.js";
I give up. This isn't the actual answer to the o.p., so I won't mark it as such. But it is what I did to address the problem - So perhaps someone will find this useful.
Note that I did take the entire app down to just an html doc with a facebook like plugin in it - No other dependencies - And yet then still IE and FF no love, Safari and Chrome fine. This was both using a protocol relative Facebook path (i.e. - "//connect.facebook.net/en_US/sdk.js") and a specified https path (i.e. "https://connect.facebook.net/en_US/sdk.js")
So rather than fight the http - https mixed content war that Gaurav pointed out may have been happening with the Facebook reference, I changed the Azure site so it always forwards http to https. Problem solved, moving on ('problem solved' being slightly different than 'question answered').
Added a web.config file consisting of the following worked for me:
````
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<rewrite>
<rules>
<rule name="Redirect HTTP to HTTPS" stopProcessing="true">
<match url="(.*)"/>
<conditions>
<add input="{HTTPS}" pattern="^OFF$"/>
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther"/>
</rule>
</rules>
</rewrite>
</system.webServer>