Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8999223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:09:05+00:00 2026-06-16T00:09:05+00:00

I had a problem with sending json forward when using node.js as a proxy

  • 0

I had a problem with sending json forward when using node.js as a proxy to prevent xss problems.

Whilst logging the data received I couldn’t find any problems.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:09:06+00:00Added an answer on June 16, 2026 at 12:09 am

    The solution came to me when I wrote another node.js server that displayed the data received and I let that mimic the CouchDB server.

    It turned out to be a non ascii character (Swedish-Å) that was the culprit. The data received was treated as raw calculating the Content-Length badly, or correct depending on your mood. 😉

    The solution was to use a Buffer to convert the raw data into utf8 before calculating Content-Length.

         :
    if (request.method == 'PUT') {
        var data = '';
        request.on('data', function(dataSnippet) {
            data += dataSnippet;
            if (data.length > 1e6) {request.connection.destroy();}
        });
        request.on('end', function(dataSnippet) {
            data = new Buffer(data, 'UTF8');     //<---  This is the solution
            options.headers = {
                'Content-Encoding': 'UTF8',
                'Content-Type': 'application/json',
                'Content-Length': data.length    //<---  Where it went wrong
            }
            proxy = http.request(options, function(proxy_response) {
                proxy_response.setEncoding('UTF8');
                proxy_response.pipe(response);
            });
            proxy.write(data);
            proxy.end();
        });
    }
        :
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We had no problem sending notifications to provisioned devices using the development certification and
I'm getting problems using the SmsManager to sending coordinates via SMS. I had a
In my previous question I had a problem with sending parameters over the command
I'm quite stuck with a problem sending mail from a PHP script. Some data:
I am facing problems in sending json response to php that I get from
A] Problem summary: I have JSON data being returned from python to javascript. I
Had a problem with the recursive conflictCheck() method. That seems fine now. I have
I had a Problem to use DotNet 4.0 DLL in a DotNet 2.0 Application,
i had a problem on confusing how to put ontouch inside my coding because
I had a problem with some JavaScript functions that had me scratching my head

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.