Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requests to /request/$REQUEST_ID.json do not redirect to JSON file #8086

Closed
mdeuk opened this issue Jan 9, 2024 · 1 comment · Fixed by #8087
Closed

Requests to /request/$REQUEST_ID.json do not redirect to JSON file #8086

mdeuk opened this issue Jan 9, 2024 · 1 comment · Fixed by #8087
Labels
bug Breaks expected functionality f:request-analysis x:uk

Comments

@mdeuk
Copy link
Collaborator

mdeuk commented Jan 9, 2024

What happened?

Since #8058 was deployed, it appears that requests to /request/$REQUEST_ID.json (where $REQUEST_ID is the numeric request ID) fail, as the browser is redirected to /request/$REQUEST_URL_NAME, which renders in html, instead of json.

Expected result

The original request should be honoured, with the redirect returning the JSON file (content-type: application/json)

Actual result

A 301 is returned, with the location missing the .json extension, which causes the result to be returned in HTML.

curl -i https://www.whatdotheyknow.com/request/$REQUEST_ID.json
HTTP/2 301
server: nginx
date: Tue, 09 Jan 2024 16:30:24 GMT
content-type: text/html
content-length: 124
cache-control: no-cache
strict-transport-security: max-age=631139040; includeSubdomains
x-permitted-cross-domain-policies: none
x-xss-protection: 1
x-request-id: c8636724-41da-47e9-ae4f-6bd089cf3f35
x-frame-options: sameorigin
x-content-type-options: nosniff
location: https://www.whatdotheyknow.com/request/$REQUEST_URL_NAME
status: 301 Moved Permanently
x-url: /request/$REQUEST_ID.json
x-host: www.whatdotheyknow.com
age: 0

<html><body>You are being <a href="https://www.whatdotheyknow.com/request/$REQUEST_URL_NAME">redirected</a>.</body></html>

Workaround

The workaround is to iterate, and add .json to the resulting url, which works as expected - but this may break some tooling which relies on hardcoded values.

Related

@mdeuk mdeuk added x:uk bug Breaks expected functionality f:request-analysis labels Jan 9, 2024
@HelenWDTK
Copy link
Contributor

+1 This will have also broken some of the scripts that I use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Breaks expected functionality f:request-analysis x:uk
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants