You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ankur Gupta <gu...@gmail.com> on 2015/06/17 05:49:47 UTC
redirect to website not working
I have apache tomacat 7.0.61 and linux server 6.1 enterprise.
There is a requirment of sending sms to the customers, but the request to
send sms to the vendor is throught this sftp linux server.
Now, when i redirect to the page it does not respond.But when i access the
same website through command line wget "http://xyz.com" linux does execute
that and i can get sms.
one more information before wget i set http_proxy in command line like
$export http_proxy=xx.xx.xx.xx:yy/
so there is a need to set proxy in apache tomcat too in order to redirect
to public page?
Thank you
Re: redirect to website not working
Posted by chris derham <ch...@derham.me.uk>.
> ... how can I share
> the result of fiddler to you if the system dosent allow attachments?
Ankur,
Copy/paste the text of the raw response into an email should do it
Chris
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: redirect to website not working
Posted by André Warnier <aw...@ice-sa.com>.
Ankur Gupta wrote:
> Thank you for your help...
> xx.xxx.xx.81 server through which iam using ie is not accessed to public
> website.This might be the problem.
>
> I want to ask a noob question that is there any method , as 81 server is
> not accessed to public websites but Linux server has access , so any
> method,way so that request can be sent to public website through Linux
> server . Linux server can be accessed through 81 server only.
> I have to use 81 server ie to request public website SMS sender vendor
> through Linux server.
>
Yes, there exist ways to do that. But they are not simple to set up, and it would make
the diagnostic of future problems much more complicated.
It can also introduce security issues.
In other words, this is not really "noob level".
For information only, here is information about how it's done :
http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxyrequests
But read the content of the red warning box, and do not do this unless you *really* know
what you are doing.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: redirect to website not working
Posted by Ankur Gupta <gu...@gmail.com>.
Thank you for your help...
xx.xxx.xx.81 server through which iam using ie is not accessed to public
website.This might be the problem.
I want to ask a noob question that is there any method , as 81 server is
not accessed to public websites but Linux server has access , so any
method,way so that request can be sent to public website through Linux
server . Linux server can be accessed through 81 server only.
I have to use 81 server ie to request public website SMS sender vendor
through Linux server.
Re: redirect to website not working
Posted by André Warnier <aw...@ice-sa.com>.
Hi.
I will try to give you some more tips below, but really you should try and work this out
by yourself. From what little information is available below, I still believe that there
is no problem with your application under Tomcat, but that the problem is that *the
browser* cannot access that SMS site you were talking about, or that the request that the
browser is sending to that site is invalid.
Ankur Gupta wrote:
> *Fiddler Error:*
>
...
>
> 3 302 HTTP xx.xxx.xx.99:8080
> /examples/smstrial.jsp?mobileNumber=0123456789 0
> text/html;charset=ISO-8859-1 iexplore:6656
>
Above exchange #3 seems to be the original request which the browser sends to the Tomcat
application. What you do not show, is the *content* of the response sent back by Tomcat,
except the status code, which is 302 (re-direct).
What would be interesting to see here, is the *response header* "Location:".
(you can see that also in Fiddler)
When the browser gets this 302 response from the server, it takes the content of the
Location response header, and then immediately makes a new HTTP request to that URL.
That is the exchange #4 below.
> 4 502 HTTP 180.179.218.150
> /sendurl.aspx?user=xxx&pwd=xxx&senderid=xxx&mobileno=0123456789&msgtext=Hello&smstype=0
> 512 no-cache, must-revalidate text/html; charset=UTF-8
> iexplore:6656
>
The above exchange #4, seems to be the new request that the browser makes to the SMS
server at 180.179.218.150, and that server responds with a "502" status (a server error).
This is not Tomcat anymore, and thus out of scope for this forum.
You have to figure out why that SMS server sends this response to the browser.
Something tells me that you are not really familiar with the HTTP protocol. Maybe you
should get some local help in that respect.
Each interaction between browser and server consists of one request from the browser, and
one response from the server. Fiddler shows this as one line, but you can click on that
line and then ask to see different things (maybe you should ask for the "raw" content).
Above you show the browser request, but not the server response content.
>
...
> *IE giving error:*
>
> [Fiddler] The connection to '180.179.218.150' failed.
> Error: TimedOut (0x274c).
> System.Net.Sockets.SocketException A connection attempt failed because the
> connected party did not properly respond after a period of time, or
> established connection failed because connected host has failed to respond
> 180.179.218.150:80
>
This is a bit confusing, because it seems to say that the server at 180.179.218.150 is not
responding.
Maybe the browser that you are using cannot access that IP address ? Or it can connect to
it, but something is blocking the server response to the browser.
(Firewalls or so)
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: redirect to website not working
Posted by Ankur Gupta <gu...@gmail.com>.
*Fiddler Error:*
# Result Protocol Host URL Body Caching
Content-Type Process Comments Custom
2 302 HTTP xx.xxx.xx.81:81 /abc/abc/a.asp 191
private text/html iexplore:6656
3 302 HTTP xx.xxx.xx.99:8080
/examples/smstrial.jsp?mobileNumber=0123456789 0
text/html;charset=ISO-8859-1 iexplore:6656
4 502 HTTP 180.179.218.150
/sendurl.aspx?user=xxx&pwd=xxx&senderid=xxx&mobileno=0123456789&msgtext=Hello&smstype=0
512 no-cache, must-revalidate text/html; charset=UTF-8
iexplore:6656
Request Count: 1
Bytes Sent: 630 (headers:630; body:0)
Bytes Received: 719 (headers:207; body:512)
ACTUAL PERFORMANCE
--------------
ClientConnected: 11:07:26.500
ClientBeginRequest: 11:07:26.734
GotRequestHeaders: 11:07:26.765
ClientDoneRequest: 11:07:26.765
Determine Gateway: 0ms
DNS Lookup: 0ms
TCP/IP Connect: 21025ms
HTTPS Handshake: 0ms
ServerConnected: 11:07:47.781
FiddlerBeginRequest: 00:00:00.000
ServerGotRequest: 00:00:00.000
ServerBeginResponse: 00:00:00.000
GotResponseHeaders: 00:00:00.000
ServerDoneResponse: 00:00:00.000
ClientBeginResponse: 11:07:47.812
ClientDoneResponse: 11:07:47.812
Overall Elapsed: 00:00:21.0781250
RESPONSE BYTES (by Content-Type)
--------------
text/html: 512
~headers~: 207
ESTIMATED WORLDWIDE PERFORMANCE
--------------
The following are VERY rough estimates of download times when hitting
servers based in Seattle.
US West Coast (Modem - 6KB/sec)
RTT: 0.10s
Elapsed: 0.10s
Japan / Northern Europe (Modem)
RTT: 0.15s
Elapsed: 0.15s
China (Modem)
RTT: 0.45s
Elapsed: 0.45s
US West Coast (DSL - 30KB/sec)
RTT: 0.10s
Elapsed: 0.10s
Japan / Northern Europe (DSL)
RTT: 0.15s
Elapsed: 0.15s
China (DSL)
RTT: 0.45s
Elapsed: 0.45s
________________
*IE giving error:*
[Fiddler] The connection to '180.179.218.150' failed.
Error: TimedOut (0x274c).
System.Net.Sockets.SocketException A connection attempt failed because the
connected party did not properly respond after a period of time, or
established connection failed because connected host has failed to respond
180.179.218.150:80
Re: redirect to website not working
Posted by André Warnier <aw...@ice-sa.com>.
Ankur Gupta wrote:
> I had installed fiddler and deactivated ie stupid feature . how can I share
> the result of fiddler to you if the system dosent allow attachments?
>
Well, on this list here we try to help, and we provide tips.
But we do not do all the work for you, and you are expected to do some of it yourself.
(You can of course always ask for a private consultant, there are pointers for that on the
Tomcat website.)
You have already gotten now to the point where you know that your webapp under Tomcat, is
sending the (presumably) correct 302 response to the browser.
With Fiddler, you can now examine this server response more in detail, to see if it is
really what it should be.
And you have disabled the friendly error pages, so you can see what the error really is,
from the browser point of view.
Does that help to diagnose your problem ?
And if you need to send more information to the list about what you see in Fiddler, I
believe that you just need to do a right-click on that specific response, and it will
propose a choice of things to do, among which there must be a copy-to-clipboard option.
You can then paste that specific line into your next message to the list, if needed.
But try to do some thinking by yourself first. It helps in the long run.
One request : if you find the solution yourself, please post it to the list also.
It will help someone else in the future, if they are smart enough to search the list
archives first.
See : http://tomcat.apache.org/lists.html
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: redirect to website not working
Posted by Ankur Gupta <gu...@gmail.com>.
I had installed fiddler and deactivated ie stupid feature . how can I share
the result of fiddler to you if the system dosent allow attachments?
Re: redirect to website not working
Posted by André Warnier <aw...@ice-sa.com>.
Ankur Gupta wrote:
> Log says this:
>
> xx.xxx.xx.81 - - [17/Jun/2015:12:51:47 -0400] "GET
> /examples/smstrial.jsp?mobileNumber=0123456789 HTTP/1.1" 302 -
>
> xx.xxx.xx.81 - - [17/Jun/2015:12:52:16 -0400] "GET
> /examples/smstrial.jsp?mobileNumber=0123456789 HTTP/1.1" 302 -
>
> xx.xxx.xx.81 - - [17/Jun/2015:12:53:05 -0400] "GET /examples/smstrial.jsp
> HTTP/1.1" 302 -
>
> xx.xxx.xx.81 - - [17/Jun/2015:12:53:17 -0400] "GET /examples/smstrial.jsp
> HTTP/1.1" 302 -
>
> xx.xxx.xx.81 - - [17/Jun/2015:12:53:32 -0400] "GET /examples/smstrial.jsp
> HTTP/1.1" 302 -
>
> xx.xxx.xx.81 - - [17/Jun/2015:12:54:39 -0400] "GET /examples/smstrial.jsp
> HTTP/1.1" 302 139
>
> xx.xxx.xx.81 - - [17/Jun/2015:12:55:16 -0400] "GET /examples/smstrial.jsp
> HTTP/1.1" 302 139
>
>
>
> Browser is Internet Explorer and it gives error
>
> [image: Inline image 1]
>
Ankur Gupta wrote:
> [image: Inline image 1]
>
Yes, that is the stupid built-in Internet Explorer "friendly error page", which doesn't
tell you anything worth knowing.
Go to Tools -> Internet Options -> advanced
and disable the "friendly error pages" option.
Better : get Fiddler (http://www.telerik.com/fiddler)
install it, activate it, repeat your session and look at what is really sent and received
by the browser. Look in particular at the content of the "Location" header received by the
browser in the 302 responses, if it is what you expect.
(Note : the content of that header should be a full absolute URL to the desired site)
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: redirect to website not working
Posted by André Warnier <aw...@ice-sa.com>.
Hi.
Ankur Gupta wrote:
> Log says this:
>
> xx.xxx.xx.81 - - [17/Jun/2015:12:51:47 -0400] "GET
> /examples/smstrial.jsp?mobileNumber=0123456789 HTTP/1.1" 302 -
>
> xx.xxx.xx.81 - - [17/Jun/2015:12:52:16 -0400] "GET
> /examples/smstrial.jsp?mobileNumber=0123456789 HTTP/1.1" 302 -
>
> xx.xxx.xx.81 - - [17/Jun/2015:12:53:05 -0400] "GET /examples/smstrial.jsp
> HTTP/1.1" 302 -
>
> xx.xxx.xx.81 - - [17/Jun/2015:12:53:17 -0400] "GET /examples/smstrial.jsp
> HTTP/1.1" 302 -
>
> xx.xxx.xx.81 - - [17/Jun/2015:12:53:32 -0400] "GET /examples/smstrial.jsp
> HTTP/1.1" 302 -
>
> xx.xxx.xx.81 - - [17/Jun/2015:12:54:39 -0400] "GET /examples/smstrial.jsp
> HTTP/1.1" 302 139
>
> xx.xxx.xx.81 - - [17/Jun/2015:12:55:16 -0400] "GET /examples/smstrial.jsp
> HTTP/1.1" 302 139
>
>
That log seems fine to me. It shows that your application is indeed returning the 302
responses to the browser.
Unfortunately, this does not really show us *to what* the re-direction is, from the point
of view of the browser.
>
> Browser is Internet Explorer and it gives error
>
> [image: Inline image 1]
>
Unfortunately, the list software strips embedded images, and most attachments.
Do you have any way to post that image somewhere (or describe it), so that we know what
error this is exactly ?
Note : if you are using IE, you may need to change a setting, in order to see the real
error page sent by the server, rather than the "friendly" page that IE itself is showing.
Go to preferences, in "advanced", and disable the "send friendly error messages" box, then
try again.
I also suggest that you add a plugin to the browser, such as Fiddler2 for IE.
This will allow you to see "exactly" what the server sends as a response, including the
"Location:" header, which is essential here to determine what the problem is.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: redirect to website not working
Posted by Ankur Gupta <gu...@gmail.com>.
Log says this:
xx.xxx.xx.81 - - [17/Jun/2015:12:51:47 -0400] "GET
/examples/smstrial.jsp?mobileNumber=0123456789 HTTP/1.1" 302 -
xx.xxx.xx.81 - - [17/Jun/2015:12:52:16 -0400] "GET
/examples/smstrial.jsp?mobileNumber=0123456789 HTTP/1.1" 302 -
xx.xxx.xx.81 - - [17/Jun/2015:12:53:05 -0400] "GET /examples/smstrial.jsp
HTTP/1.1" 302 -
xx.xxx.xx.81 - - [17/Jun/2015:12:53:17 -0400] "GET /examples/smstrial.jsp
HTTP/1.1" 302 -
xx.xxx.xx.81 - - [17/Jun/2015:12:53:32 -0400] "GET /examples/smstrial.jsp
HTTP/1.1" 302 -
xx.xxx.xx.81 - - [17/Jun/2015:12:54:39 -0400] "GET /examples/smstrial.jsp
HTTP/1.1" 302 139
xx.xxx.xx.81 - - [17/Jun/2015:12:55:16 -0400] "GET /examples/smstrial.jsp
HTTP/1.1" 302 139
Browser is Internet Explorer and it gives error
[image: Inline image 1]
Re: redirect to website not working
Posted by André Warnier <aw...@ice-sa.com>.
Ankur Gupta wrote:
> xx.xx.xx.81 has classic asp page sms.asp having code:
>
> <%@ language=vbscript%>
>
> <%
>
> mobileNumber="0123456789"
>
> Response.redirect("
> http://xx.xxx.xx.99:8080/examples/smstrial.jsp?mobileNumber="& mobileNumber)
>
> %>
>
>
>
> Linux server(xx.xxx.xx.99:8080) with apache tomcat and linux v6.1
> Enterprise has jsp page named smstrial.jsp having jsp code:
>
> <%@ page import="java.io.*,java.util.*"%>
>
> <HTML>
>
> <HEAD>
>
> <TITLE> New Document </TITLE>
>
> </HEAD>
>
> <BODY>
>
> <center>
>
> <h1>Page Redirection</h1>
>
> </center>
>
> <%
>
> String mobile=request.getParameter("mobileNumber");
>
> String site="
> http://180.179.218.150:80/sendurl.aspx?user=xyz&pwd=xyz&sen
> derid=xyz&mobileno="+mobile+"&msgtext=Hello&smstype=0";
>
> response.sendRedirect(site);
>
> %>
>
> </BODY>
>
> </HTML>
>
>
>
>
>
>
>
> Now from xx.xx.xx.81 iam calling sms.asp page from internet explorer and
> getting error.
Ahaaa ! you are getting an error !
Do you care to share what error you are getting, and where ?
And have you looked into any relevant server log, to find out what that error may be due to ?
>
> If i change redirect webpage called in jsp code to some intranet server,e.g
> xx.xx.xx.54 (which is not use for public website. It is used internally in
> the organization and xx.xx.xx.81 server is connected to xx.xx.xx.54 )
> then xx.xx.xx.81 browser successfully redirects to it without any issue.
>
>
>
> Linux server xx.xxx.xx.99:8080 is connected to internet.
>
> When we use wget command like
>
> Wget http://180.179.218.150:80/sendurl.aspx?user=xyz&pwd=xyz&sen
> derid=xyz&mobileno="+mobile+"&msgtext=Hello&smstype=0 then it successfully
> executes it.
>
>
>
> I hope this helps . Thank you for giving you time.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: redirect to website not working
Posted by Ankur Gupta <gu...@gmail.com>.
xx.xx.xx.81 has classic asp page sms.asp having code:
<%@ language=vbscript%>
<%
mobileNumber="0123456789"
Response.redirect("
http://xx.xxx.xx.99:8080/examples/smstrial.jsp?mobileNumber="& mobileNumber)
%>
Linux server(xx.xxx.xx.99:8080) with apache tomcat and linux v6.1
Enterprise has jsp page named smstrial.jsp having jsp code:
<%@ page import="java.io.*,java.util.*"%>
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>
<BODY>
<center>
<h1>Page Redirection</h1>
</center>
<%
String mobile=request.getParameter("mobileNumber");
String site="
http://180.179.218.150:80/sendurl.aspx?user=xyz&pwd=xyz&sen
derid=xyz&mobileno="+mobile+"&msgtext=Hello&smstype=0";
response.sendRedirect(site);
%>
</BODY>
</HTML>
Now from xx.xx.xx.81 iam calling sms.asp page from internet explorer and
getting error.
If i change redirect webpage called in jsp code to some intranet server,e.g
xx.xx.xx.54 (which is not use for public website. It is used internally in
the organization and xx.xx.xx.81 server is connected to xx.xx.xx.54 )
then xx.xx.xx.81 browser successfully redirects to it without any issue.
Linux server xx.xxx.xx.99:8080 is connected to internet.
When we use wget command like
Wget http://180.179.218.150:80/sendurl.aspx?user=xyz&pwd=xyz&sen
derid=xyz&mobileno="+mobile+"&msgtext=Hello&smstype=0 then it successfully
executes it.
I hope this helps . Thank you for giving you time.
Re: redirect to website not working
Posted by André Warnier <aw...@ice-sa.com>.
Ankur Gupta wrote:
> Sorry if I was unable to make you understand .
> At my workplace we have one production server which have iis and classic
> asp pages are deployed.
Ok, that I understand.
Server-A = IIS + whatever
Now as per the requirement
(of which we do not have a copy, so we know nothing about it)
, we have to send SMS to
> the customers,
Who is "we" ?
so , a request from production server say A(having asp page)
ok, Server-A above sends HTTP request directly to ..
> is sent to Linux server having tomcat say B(having jsp page).
So Server-B is your Tomcat server with your application..
B server has
> jsp page which is called and a simple code
(of which we do not have a copy either, so we know nothing about it)
is written to redirect to public
> website
"redirect", in HTTP terms, has a very precise meaning. It means that your application is
sending a response *to the browser*, and this response is a "redirect" response
with a status code 301 or 302.
See : https://en.wikipedia.org/wiki/HTTP_301
or : https://en.wikipedia.org/wiki/HTTP_302
and when your application sends such a response to the browser, and the browser receives
it, *the browser* immediately and automatically sends another request to the indicated
website.
(And this does not involve Tomcat at all anymore).
Is that what happens ?
which is responsible for sending SMS.
>
(so that also has nothing to do with Tomcat)
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: redirect to website not working
Posted by Ankur Gupta <gu...@gmail.com>.
Sorry if I was unable to make you understand .
At my workplace we have one production server which have iis and classic
asp pages are deployed. Now as per the requirement , we have to send SMS to
the customers, so , a request from production server say A(having asp page)
is sent to Linux server having tomcat say B(having jsp page). B server has
jsp page which is called and a simple code is written to redirect to public
website which is responsible for sending SMS.
Re: redirect to website not working
Posted by André Warnier <aw...@ice-sa.com>.
Ankur Gupta wrote:
> I have apache tomacat 7.0.61 and linux server 6.1 enterprise.
> There is a requirment of sending sms to the customers, but the request to
> send sms to the vendor is throught this sftp linux server.
> Now, when i redirect to the page it does not respond.But when i access the
> same website through command line wget "http://xyz.com" linux does execute
> that and i can get sms.
> one more information before wget i set http_proxy in command line like
> $export http_proxy=xx.xx.xx.xx:yy/
> so there is a need to set proxy in apache tomcat too in order to redirect
> to public page?
> Thank you
>
Hi.
On this list, we have quite a lot of experience at decyphering user requests for help.
We even have some good SSL specialists available to answer questions.
But your question above is hopelessly confusing.
Could you try to rephrase this, so that we could have a hope to understand what your
question is really about ? (maybe a little schema may help)
In the meantime, I'll answer this :
Q : > so there is a need to set proxy in apache tomcat too in order to redirect
> to public page?
A: no.
In simplified terms : the browser makes the connection to Tomcat to send its request; and
Tomcat sends responses to the browser on that same connection. So it does not need a proxy
for that.
If your application is sending a redirect response to the browser, that is a response, so
it goes through that same connection.
If your webapp itself needs to access another webserver, then it would be another matter,
and it might need a proxy for doing that.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org