-
Notifications
You must be signed in to change notification settings - Fork 80
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
NSFS | S3 throwing error for empty header and default port for STS #8579
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -197,9 +197,8 @@ async function main(options = {}) { | |
// START S3, STS & IAM SERVERS & CERTS | ||
const http_port_s3 = options.http_port || config.ENDPOINT_PORT; | ||
const https_port_s3 = options.https_port || config.ENDPOINT_SSL_PORT; | ||
const https_port_sts = options.https_port_sts || Number(process.env.ENDPOINT_SSL_PORT_STS) || 7443; // || (process.env.NC_NSFS_NO_DB_ENV === 'true' ? -1 : 7443); | ||
const https_port_sts = options.https_port_sts || config.ENDPOINT_SSL_STS_PORT; | ||
const https_port_iam = options.https_port_iam || config.ENDPOINT_SSL_IAM_PORT; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you can add back the newline, I think we wanted a separation between the port's definitions and the calls to the functions. |
||
await start_server_and_cert(SERVICES_TYPES_ENUM.S3, init_request_sdk, | ||
{ ...options, https_port: https_port_s3, http_port: http_port_s3, virtual_hosts, bucket_logger, notification_logger }); | ||
await start_server_and_cert(SERVICES_TYPES_ENUM.STS, init_request_sdk, { https_port: https_port_sts, virtual_hosts }); | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -112,7 +112,7 @@ async function handle_request(req, res) { | |||||
http_utils.set_cors_headers_s3(req, res, cors); | ||||||
|
||||||
if (req.method === 'OPTIONS') { | ||||||
dbg.log1('OPTIONS!'); | ||||||
dbg.log1('s3_rest : S3 request method is ', req.method); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm suggesting to add the function name in the logs
Suggested change
|
||||||
const error_code = req.headers.origin && req.headers['access-control-request-method'] ? 403 : 400; | ||||||
const res_headers = res.getHeaders(); // We will check if we found a matching rule - if no we will return error_code | ||||||
res.statusCode = res_headers['access-control-allow-origin'] && res_headers['access-control-allow-methods'] ? 200 : error_code; | ||||||
|
@@ -334,7 +334,7 @@ function _get_arn_from_req_path(req) { | |||||
// we will reintreduce it together with bucket site support. | ||||||
function parse_bucket_and_key(req) { | ||||||
const { url, headers, virtual_hosts } = req; | ||||||
const host = headers.host.split(':')[0]; // cutting off port | ||||||
const host = headers?.host?.split(':')[0]; // cutting off port | ||||||
|
||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @naveenpaul1 do we need to throw here an error about this missing host header? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @romayalon I am not sure how to send the request to AWS s3 without host header, In doc I could see host header is required property for AWS S3. doc There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this point is still open, if you decide on something could you please update it here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @romayalon I sent There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @naveenpaul1 if you attach the host header, do you have access to the bucket? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @romayalon I send the request from JS, to make sure no headers.
Not 100% sure this will send request without any default header, since we cant check in AWS S3 side. It dont have any access credentials. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @naveenpaul1 we print headers on our logs, try this code directed to NooBaa and check the logs There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @romayalon tried the same even this request have header info There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @romayalon I tried with AWS S3 url and its I didnt get any response for the request.
|
||||||
let virtual_host = null; | ||||||
if (host && host !== 'localhost' && !net.isIP(host)) { | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just add a comment for us that when we will support STS in NSFS we can remove this condition.