wish: add --host flag (or custom headers) in headless mode

UNCONFIRMED
Unassigned

Status

()

enhancement
P5
normal
UNCONFIRMED
2 years ago
6 months ago

People

(Reporter: rn214, Unassigned)

Tracking

57 Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Reporter

Description

2 years ago
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0
Build ID: 20171017080545

Steps to reproduce:

1. Set up apache with multiple vHosts on the same machine. So, externally, 
 https://a.example.com    #Site A
 https://b.example.com    #Site B - completely unrelated to site A.
are both hosted on the same server.

2. On that server, we want to get a screenshot of site B, but we need to access it as localhost (because, say, the DNS for A and B is external, and we are behind HAProxy).  So we do:

  firefox --screenshot out.jpg http://localhost/file.html



Actual results:

3. Depending on how Apache is set up, a connection to localhost will return either site A or site B. This is not necessarily what we want!




Expected results:

It would be nice to have a --host flag, which allows us, if the site is localhost, to specify which vHost we actually mean. 

For example, wkhtmltopdf supports:
  --custom-header 'Host' 'b.example.com'

There are several reasons why we may require this approach:
(a) If we are on a production server, but the webserver only can do a DNS lookup for localhost (e.g. we are behind a proxy or firewall)
(b) If we are the dev site for a production server, where in fact, the DNS needs to point at the dev site - localhost is therefore a safer config choice for code which may run on both dev and prod.
Severity: normal → enhancement
Component: Untriaged → Headless
Flagging Harald to triage.
Flags: needinfo?(hkirschner)
So far not many more signals and this isn't parity. We'll include this in future planning around automation.
Flags: needinfo?(hkirschner)
Priority: -- → P5
You need to log in before you can comment on or make changes to this bug.