Re: Forwarding request to a different servlet

2023-08-13 Thread Andy Pont

I wrote...


Progress of sorts!  The request is now returning 302 instead of 404!

Looking in the log files for the backend, it has a message that says “Robot 
requests must be rejected” and the 302 response is due to a redirect to a 
permission denied page.

My understanding was the .forward() method didn’t change anything on route in 
either direction.
Using JD-GUI I have looked at the class that is generates the above 
error message and it appears as the result of a check on the 
“user-agent” setting.  I am now puzzled as what is being received by the 
backend servlet is the same as if it is called directly without me 
intercepting it.


The class I looked at contains a definition of a valid non-robot 
user-agent string.  Is it possible to modify the request to use this 
before forwarding it?  If not, am I better creating a new request for 
the backend and copy HTTP header and body content around as needed?

-Andy.

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Java Connector help needed

2023-08-13 Thread Charlie DiDonato
Hi All,
I am migrating from tomcat 8.5x to 9.0.78

Below is my server .xml

I don't have Apache webserver fronting this yet on my local machine (Windows
10).

It is a Java app.

 

Here is the part that I feel is relevant, but the full config is listed
below that.-

I order to see that tomcat is working without Apache WS, do I need to also
create an HTTP1.1 connector in addition to AJP connector?

And what should happen when I define a redirectPort ?

And finally, how do I access tomcat URL to hit tomcat and bypass Apache WS?

Thanks

Charlie DiDonato

 

 







 

 

 

 

 

 









  

  

  

  

  

  

  

  

 

  

  





  

 

  

  

 





 

 















 









 



 





 

  

  

  

 

 

  

  





  

 

  

 





 





 

  



  





AW: Java Connector help needed

2023-08-13 Thread Thomas Hoffmann (Speed4Trade GmbH)
Hello Charlie,

> -Ursprüngliche Nachricht-
> Von: Charlie DiDonato 
> Gesendet: Sonntag, 13. August 2023 18:08
> An: users@tomcat.apache.org
> Betreff: Java Connector help needed
> 
> Hi All,
> I am migrating from tomcat 8.5x to 9.0.78
> 
> Below is my server .xml
> 
> I don't have Apache webserver fronting this yet on my local machine
> (Windows 10).
> 
> It is a Java app.
> 
> 
> 
> Here is the part that I feel is relevant, but the full config is listed below 
> that.-
> 
> I order to see that tomcat is working without Apache WS, do I need to also
> create an HTTP1.1 connector in addition to AJP connector?

The browser only speaks HTTP protocol. So yes, if you want to bypass Apache 
Frontend-server you need an http connector on tomcat side.

> 
> And what should happen when I define a redirectPort ?

The redirect Port is only used, when Tomcat needs to redirect HTTP to HTTPS.
If you only use HTTP or only HTTPS, this attribute is not used.

> And finally, how do I access tomcat URL to hit tomcat and bypass Apache WS?

This depends on your infrastructure. You can use a separate http(s) port. E.g. 
80/443 is used by Apache and 8080 is used by Tomcat.
Then you can used http://:8080/ to access Tomcat directly. Of 
course, firewall etc. must allow this traffic.
 
> Thanks
> 
> Charlie DiDonato
> 
> 
> 
> 
> 
> 
> 
> 
> 
>  
>address="192.168.0.28"
> 
>port="8009"
> 
>redirectPort="8020"
> 
>secretRequired="false"
> 
>maxParameterCount="1000"
> 
>/>
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>/>
> 
>   
> 
>   
> 
>SSLEngine="on" />
> 
>   
> 
>className="org.apache.catalina.core.JreMemoryLeakPreventionListener"
> />
> 
>className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
> />
> 
>className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"
> />
> 
> 
> 
>   
> 
>   
> 
> 
> 
>  
>   type="org.apache.catalina.UserDatabase"
> 
>   description="User database that can be updated and saved"
> 
>   factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
> 
>   pathname="conf/tomcat-users.xml" />
> 
>   
> 
> 
> 
>   
> 
>   
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>  
>address="192.168.0.28"
> 
>port="8009"
> 
>redirectPort="8020"
> 
>secretRequired="false"
> 
>maxParameterCount="1000"
> 
>/>
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>   
> 
> 
> 
>   
> 
> 
> 
> 
> 
>   
> 
>   
> 
> 
> 
>  
>resourceName="UserDatabase"/>
> 
>   
> 
> 
> 
>
> unpackWARs="true" autoDeploy="true">
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>  directory="logs"
> 
>prefix="localhost_access_log" suffix=".txt"
> 
>pattern="%h %l %u %t "%r" %s %b" />
> 
> 
> 
>   
> 
> 
> 
>   
> 
> 


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org