We have moved to Github. Please open tickets there.

Opened 2 years ago

Closed 17 months ago

#3514 closed Enhancement (duplicate)

Elgg needs to send a 404 for requests that are not registered

Reported by: vazco Owned by:
Priority: normal Milestone: Elgg 1.8.x
Component: Core Version: 1.8 Beta
Severity: minor Keywords:
Cc: brett@… Difficulty: easy

Description

If we set url in elgg_register_js or elgg_register_css to non-existing file in Elgg directory, main page is pulled instead of js/css. It would be much better if non-existent files would return error 404 in this case. Otherwise, it's hard to find which file has wrong path.

Maybe we could use some sort of handler for such files?

Change History (4)

comment:1 Changed 2 years ago by cash

Can you provide more details? I wasn't able to reproduce this.

comment:2 Changed 2 years ago by vazco

example:
I have a file:
http://mysite.com/mod/modname/vendors/javascript.js

When I declare (note typo in link):

elgg_register_js("javascript", "http://mysite.com/mod/modname/vendors/javascript_typohre.js");

in firebug you can see Elgg tries to load link without success (this load don't appear in debug):
http://mysite.com/mod/modname/vendors/javascript_typohre.js

and loads main page or activity afterwards:
http://mysite.com/activity

If there was some convention, eg. to place all javascript in modname/vendors directory, we could declare:
elgg_register_js("javascript", "http://mysite.com/vendors/modname/javascript_typohre.js");

and in case of typo, we could get error 404 instead of redirecting to main page - what takes additional processing.

There may be probably some other solution to this issue.

comment:3 Changed 2 years ago by cash

  • Difficulty set to easy
  • Milestone changed from Needs Review to Elgg 1.8.x
  • Summary changed from elgg_register_js redirects to main page if wrong url set to Elgg needs to send a 404 for requests that are not registered

I understand now. The problem is that the new rewrite rules grab all URLs if there is not a file. We need a general 404 page then.

comment:4 Changed 17 months ago by cash

  • Resolution set to duplicate
  • Status changed from new to closed

duplicate of #4103

Note: See TracTickets for help on using tickets.