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

Provide option to force /addItem request to use form-data content type #1122

Closed
zhif7782 opened this issue Sep 4, 2023 · 3 comments
Closed
Labels

Comments

@zhif7782
Copy link

zhif7782 commented Sep 4, 2023

Describe the problem

In the last step of creating a Survey123 report, we utilize /addItem to add the generated report file (.docx or .pdf) as an item. Since the report file already exists in S3 bucket, we use dataUrl property and send the request in x-www-form-urlencoded type to let portal download the file instead of uploading a binary file in form-data type. This works for most cases.

However, it turns out that some user's web application firewall rejects the /addItem request if the request is send in x-www-form-urlencoded type AND there are any HTML contents (e.g. <a> tag in item's description property) in the request.

Describe the proposed solution

Provide an option to send the /addItem request, even all POST requests, as form-data content type even no binary file in the request.

Alternatives considered

No response

Additional Information

Similar to #499

@gavinr-maps
Copy link
Contributor

HI @zhif7782, thanks for the issue. Could you give a few more details on - are you sure it's related to x-www-form-urlencoded vs form-data? Or maybe it's related specifically to the /addItem call with HTML contents?

We have not heard of these issues from others - I'm wondering if there's some other issue going on here.

@zhif7782
Copy link
Author

Hi @gavinr-maps , the problem was caused by the Firewall settings in the client's Enterprise deployment, which might be an intentional setting. We confirmed this issue by doing a minimum test in Postman: as long as we change x-www-form-urlencoded to form-data and keep all other parameters unchanged, the /addItem request succeeded.

The workaround fix in the Survey123 report service code currently only changes x-www-form-urlencoded to form-data when sending the specific /addItem request, which also fixed the report workflow for this client's environment.

image

@gavinr-maps
Copy link
Contributor

Ok thanks for the info. Since this is a specific firewall setting, it doesn't seem like that should be a general change that should be applied for everyone who uses ArcGIS REST JS. So I'll close this for now but if others have similar issues please log here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants