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

  • Home
  • SEARCH
  • 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 8405577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:53:07+00:00 2026-06-09T22:53:07+00:00

I have implemented simple proxy server using Java NIO channels, but have a problem,

  • 0

I have implemented simple proxy server using Java NIO channels, but have a problem, some sites works perfectly, but other give an error about unknown path or redirect on technical page of its hoster with message the resource doesn’t exist. Is it my fault or may be some sites don`t allow proxy?

ProxyServer works as this: I enter ‘localhost’ and in browser I recive site that was set in code. And request from browser I simply resend on target site at such way:

private void connect(SelectionKey key) throws IOException {
    SocketChannel channel = ((SocketChannel) key.channel());
    Attachment attachment = (Attachment) key.attachment();
    channel.write(attachment.buffer);
}

So ‘key’ – is SelectionKey of target site and in attachment.buffer I store request that was send to proxy server.

So, something worng with my code or its just closed opportunity to proxy by sites?

Update 1. I suppose, I found a problem. Cause I redirect request from localhost to remote server AS IS so in request in field HOST I have ‘localhost’. It seems like some sites ignore this fields, other try to use and redirect to 404 page, cause can’t find ‘localhost’ I`m asking for. So question is how to change field ‘Host’ in request on destination server name?

  • 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-09T22:53:08+00:00Added an answer on June 9, 2026 at 10:53 pm

    I found a problem. filed HOST after proxy contains ‘localhost’, so some sites accept it, other not. Replace value of this fields with real host fix the problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have implemented simple com.sun.net.httpserver.HttpServer application using one of examples in the internet. Server
Hi have implemented simple file exchange over a client/server connection in c++. Works fine
I have implemented a simple linux shell in c. Now, I am adding some
I have implemented a simple RSS reader in Java. I hit a URL and
I've got a simple C class I have implemented, using function pointers in a
Probably something simple, but heres my problem, I have implememnted a simple captcha into
I have implemented a simple server-client script like this: Server: class Server(Protocol): def connectionMade(self):
For a simple Java library which performs operations in constant intervals I have implemented
I have implemented a generic IPropertyChangedNotifier using castle dynamic proxy. Here I intercept setter
I am playing around with some graphics, and I have implemented simple camera movement

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.