Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 385770

Summary: [sites] Stop caching 404s served through a hosted site
Product: [ECD] Orion Reporter: Susan McCourt <susan>
Component: ServerAssignee: Mark Macdonald <mamacdon>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: libingw, mamacdon
Version: 0.5   
Target Milestone: 1.0 M2   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Susan McCourt CLA 2012-07-23 13:23:08 EDT
This bug bit me during my OSCON demo.  Here are some reproducible steps, not sure which ones are important.

1) From a Navigator, generate the "Hello World" sample.
2) Select the "Hello World" folder and Actions->View on Site.  Site comes up.
3) Click browser back button to go to navigator.  Expand "Hello World."
4) Click on hello.css and edit it.
5) Now click on "Sites" in the banner.  The sites page tells you that the hello site is running.  Click on the link itself.  You get the "Site stopped message."
6) Click on the stop button to stop the site, then restart.
7) Still you can't get to the site.

I had to generate a new site in order to get it working.

I've never seen this bug before in my normal day to day to work, but these are the differences in my demo scenario.
- it was a "View on Site" site vs. created on the sites page?
- I usually use a self hosted site vs. a simple site like Hello
- I normally open my site in another tab and keep it there.  It was during this demo that I used "view on site" and forgot to ctrl-click.  So I had to go back and then try to go again to the site from the sites page.
Comment 1 Susan McCourt CLA 2012-07-24 15:28:28 EDT
I think the bug might be as simple as "sites launched by view on site don't launch from the link in the sites page."
Comment 2 Susan McCourt CLA 2012-08-08 23:39:33 EDT
Mark, could you check whether there is an obvious problem in M1?
Comment 3 Mark Macdonald CLA 2012-08-09 17:31:11 EDT
I haven't been able to reproduce the "site is stopped" error (tried on localhost and orion.eclipse.org). 

But I do see a usability problem. In Step 5 I get an error because there's no /index.html or / defined, so there's  nothing to show when I navigate to the root of the site.

This is because "View on site" in Step 2 creates a site with the HelloWorld content at http://hello-world-site.orion.eclipse.org/Hello%20World, not http://hello-world-site.orion.eclipse.org/.

I can change the "View on site" logic to mount the folder at the root of the site when you "View on" a new site. This way you'll be able to navigate to it from the sites page and get a sensible result.
Comment 4 Mark Macdonald CLA 2012-09-04 17:37:08 EDT
OK, I (finally) came up with an explanation for this.

1. Load http://susans-demo.orion.eclipse.org/ while the site is stopped.
 --> browser caches the 404.
2. Run Actions->View on site. The site is started, and you're taken to http://susans-demo.orion.eclipse.org/Hello%World/ 
 --> this URL loads as expected.
3. Click through from the Sites page to http://susanstestsite.orion.eclipse.org/
 --> browser serves the cached 404.

* In Step 1, the hosted site URL gets swept up by our server-wide cache filter:
> Cache-Control:max-age=900, must-revalidate
This means the site root will appear to be "stopped" until 15 minutes has passed or you do Ctrl+Shift+R on it.
* Step 2 succeeds because the /Hello%World/ URL slips past the cache filter -- it only seems to affect the root (/) and URLs that end in .(html|js|css).
* Step 3 (assuming it's run within 15 minutes of Step 1) causes the site root to appear "stopped" when it isn't.

Hosted content is supposed to be excluded from caching, but that evidently isn't happening when we serve 404s.
Comment 5 Mark Macdonald CLA 2012-09-05 13:37:37 EDT
Libing is running into this problem with plugins, and it's even more annoying.

When you're dealing with a plugin that fails to load because of a cached 404, fixing it is a 2-step process: you have to first clear the cache (or Ctrl+Shift+R), *then* reload the plugin data on the Settings page to get your services back.
Comment 6 Mark Macdonald CLA 2012-09-18 14:14:07 EDT
Add a "no-cache" instruction when serving up a "stopped" site through the sites api. 

http://git.eclipse.org/c/orion/org.eclipse.orion.server.git/commit/?id=b42f3ed8fc476ae9de5c65e5a6761ec123014251