forwardemail / forwardemail/superagent
headers are not sent with https:// and :443
- Dominant language
- JavaScript
- Stars
- 16.6k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
The server logs the incoming request headers to verify if they arrived
#### fails with port on https
```js
function request(url, { method='get', body={} } = {}) {
url = `https://${config.host}:443${url}`
return superagent(method, url)
.set('Authorization', `token ${config.key}:${config.secret}`)
.send(body)
.then(res => {
console.log(res.statusCode)
return res
})
.catch(error => {
console.log(error.response.statusCode)
return error.response
})
}
```
makes the server not get the authorization header and answer with forbidden
#### works without port on https
```js
url = `https://${config.host}${url}`
```
#### works with port on localhost
`http://localhost:8003`
#### works when using the deprecated request package
```js
function request(url, { method='get', body={} } = {}) {
url = `https://${config.host}:443${url}`
const options = {
method,
url,
headers: {
'Authorization': `token ${config.key}:${config.secret}`
}
}
return new Promise((resolve, reject) => {
Request(options, function (error, response, body) {
console.log(response.statusCode)
if (response.statusCode == 200) {
return resolve(response)
} else {
return reject(response)
}
})
})
```
#### works with axios
```js
function request(url, { method='get', body={} } = {}) {
url = `${config.host}:${config.port}${url}`
return axios({
method,
url,
data: body,
headers: {
'Authorization': `token ${config.key}:${config.secret}`
}
})
.then(res => {
console.log(res.status)
return res
})
.catch(error => {
console.log(error.response.status)
return error.response
})
}
```
Is there any debugging information I could hand out to you?
version 6.1.0
Contributor guide
Assessment
This issue has not been assessed yet.