Feature Proposal: Use of Referer HTTP header as a source of default web.topic for RPC calls

Motivation

Foswiki is currently requiring JS frontend developers to manually define 'topic' parameter for all requests. This could be redundant.

Description and Documentation

Upon sending a XMLHttpRequest a browser might send the Referer HTTP header with URL of the originating page. The URL could be used to determine the default web and topic for RPC request objects thus possibly reducing the amount of code on the client side.

A possible caveat: presence of the header is not guaranteed. With privacy mode enabled it is rather likely that it won't be set. For this reason it cannot be relied upon and it is only good as a source of default values.

Suggestion: if 'topic' parameter is used then it would be nice to preserve and provide easy access to the default web/topic values obtained from the Referer.

Examples

Impact

%WHATDOESITAFFECT%
edit

Implementation

-- Contributors: VadimBelman - 12 Jan 2018

Discussion

Makes sense. Referrer is used during Bootstrap, as a hint as to whether the original connection was HTTP or HTTPS. When going through a proxy, there isn't always a reliable way to determine the original protocol, and the referrer adds to the picture.

-- GeorgeClark - 13 Jan 2018
 
Topic revision: r2 - 13 Jan 2018, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy