rakesh73 Posted March 21, 2018 Posted March 21, 2018 Username: rakesh73server: Tommy I have deployed a new war file using cPanel. I am facing two issues described below: 1. The servlet path is not available securely. The servlets are accessible on http:// On trying to access by https:// I get a 404 error. I was expecting the servlets to be available on a secure path just like jsp files. This could cause security issues for example if I try to send login information to a servlet, I should be sending over a secured path. 2. I set some relative paths for static resources like javascript and css files using httpServletRequest.getContextPath().My application url is <my-domain>/blog, but the httpServletRequest.getContextPath() returns a contextPath /rakesh73_blog This makes setting the relative paths very difficult. The httpServletRequest.getContextPath() should return contextPath "/blog" as visible in the last part of the application url.<my-domain>/blog Thanks
wolstech Posted March 21, 2018 Posted March 21, 2018 I've answered in your other topic and unsolved it for you. My response is copied below for reference: For #1, we don't support HTTPS for Java by default because it uses a lot of resources and means your account would use up 2 Java slots instead of one if supported both HTTP and HTTPS. It can be enabled for you, but regular HTTP won't work anymore if you want us to do this. For #2, this is a limitation of how we handle WAR files. It occurs because we deploy into a username prefixed folder. If we didn't, nobody else on the server would be able to have a WAR called "blog". We recommend naming your WAR file with the username_ in front of it (e.g username_blog) so the deployment path and the URL are the same. There is no fix other than to either rename the WAR, or develop your code to make the assumption that the username will appear in front when searching for its files.
rakesh73 Posted March 26, 2018 Author Posted March 26, 2018 Redeployed the war with <username>_blog.war. The url is <my-domain>/blog and the contextPath is /<username>_blog.war The app is still not able to find the files and submit forms. The login form needs to submit to /rakesh73_blog/login, but that page is not found as the url is <my-domain>/blog I tried setting all relative paths to /blog, but then faced cookies issue so reverted the changes. Please let me know if there is any thing that will solve the cookie issue and the contextPath issue.
Krydos Posted March 26, 2018 Posted March 26, 2018 Did this help? https://www.helionet.org/index/topic/32234-undeploy-war-file/?p=145733
rakesh73 Posted March 27, 2018 Author Posted March 27, 2018 Now I have two paths https://<my_domain>/blog and http://<my_domain>/rakesh73_blog/ https://<my_domain>/rakesh73_blog returns 404. Can this path be available.
rakesh73 Posted March 27, 2018 Author Posted March 27, 2018 I just discovered that after going to home page http://<my_domain> and then navigating to http://<my_domain>/rakesh73_blog I get the session to persist. If I go to http://<my_domain>/rakesh73_blog disrectly, session does not hold across request.s. Please do not make the changes as described in above post. I need to do some more testing. I will post again If I need anything to change. Thanks for your patience
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now