Turkey urlrewrite filter on Tomcat will not set P3P - privacy

I am trying to get Confluence 4.1.5 to work properly with IE 8, 9 and 10 with redirect from a SSO. In other words - we've hit the Privacy Policy issue (P3P).
No, I'm not a Tomcat guy. But I found some references that (I believe) told me what to do:
http://grokbase.com/t/tomcat/users/111exnp658/how-to-configure-tomcat-coyote-to-deliver-a-p3p-header-on-every-request
https://code.google.com/p/urlrewritefilter/
Based on this I was able to establish that Confluence standard installation both has:
The urlrewrite filter jar in place
The class set in web.xml
An existing urlrewrite.xml with some stuff from Atlassian
So I tried to add the following to the urlrewrite.xml file:
<rule>
<from>/*</from>
<set type="response-header" name="P3P">CP="NON DSP COR ADM OUR STP"</set>
</rule>
This however did not work very well.
To test I inserted some spelling errors (!!) and got an error message in Confluence logs. So I know that the file is read. However, I do not understand why my p3p isn't set (I have verified with IE and Firefox. The p3p value set on e.g. www.w3.org is not similarly set when I navigate Confluence).
I've opened a support case with Atlassian. But they basically state that "this is not under the support agreement" which I guess I kind of agree on.
So - can someone guide me in the right direction? Will this never work? Am I missing a crucial part?
Please not, for anyone answering, that I am really not acquainted with Tomcat at all, so consider me a Newb when you answer :)
Thank you in advance.

I had a second look at the web.xml file for the urlrewrite entry. I found that Atlassian had added specific settings for the filter to kick in. So "my" rules never actually kicked in. I changed these to /* and verified that it now worked as expected.
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<!--<url-pattern>/s/*</url-pattern>-->
<url-pattern>/*</url-pattern>
</filter-mapping>
Now I have to figure out Atlassians intention with the /s/* (I know what they do, but I do not know why they added this. Test installation seems to run just fine).

Related

HttpRedirects in Web.Config not redirecting as desired

I'm running IIS10 in my dev server but only IIS8.5 on my production server. I'm just pointing out - nothing to do with the issue I have.
I'm using C#/web forms with url routing and am looking to move some httpredirects into my web.config file.
Having looked at the documentation, I have configured it like this:
<httpRedirect enabled="true" httpResponseStatus="Permanent" exactDestination="true">
<add wildcard="/red-widget2" destination="/widgets/red-widget" />
</httpRedirect>
Given that I've used exact destination, I expected just that, but it's not what I'm currently getting.
If I enter a url like this:
https://example.com/red-widget2
I expect a destination like this:
https://example.com/widgets/red-widget
But I actually get this:
https://example.com/widgets/red-widget/red-widget2
I've tried all the attributes to no avail, so how do I correctly configure this redirect?
Here's the answer for anyone else that falls into this trap.
The code I posted above works - it's just that IIS/Chrome doesn't want me to know.
I exited IIS, shut down the project, restarted VS, but still was left with the same issue.
However, when I cleared my browser cache and tried again, I got the answer I needed. What happened was, while I was testing, either IIS or the browser decided they were gonna keep hold of the wrong redirects and keep presenting them back to me, no matter what I changed.
So there it is - if you don't get it right first time, clear your browser cache.

DotNetNuke URL rewrite issue

I would like to shorten this: http://www.example.com/desktopmodules/imm/ims_cddetail/playtrack.aspx?trackid=18353
to http://www.example.com/playtrack/18353
IIS is no help. It suggests http://www.example.com/trackid/18353 and when I choose that, it doesn't work anyway.
I created a virtual IIS directory in the main site called "playtrack" and pointed it to the proper path. But, I still am left with http://www.example.com/playtrack/playtrack.aspx?trackid=18353.
Any suggestions?
I was looking in completely the wrong place. Dotnetnuke's Configuration Manager has a section called SiteUrls. I simply entered a rule in that:
<RewriterRule>
<LookFor>[^?]*/playtrack/(\d+)</LookFor>
<SendTo>~/desktopmodules/imm/ims_cddetail/playtrack.aspx?trackid=$1</SendTo>
</RewriterRule>
I suggest you to read https://msdn.microsoft.com/en-us/library/cc668201.aspx, you will find everything that you need about the url in aspx. You must create custom route type, for more info please read the documentation of microsoft. Especially your question is answered in the topic which called "Adding routes to a web form application".

500 Internal Server Error IIS7 Encoded url

Im using N2Cms and am looking in to some issues i have with it. It has a navigation panel on the left hand side that loads via ajax as you expand the tree.
The code that gets the childeren of the node calls an ashx file with some parameters. One parameter is for a path and contains slashes in it. For this reason it has been encoded.
.../cms/Content/Navigation/LoadTree.ashx?target=preview&selected=%252fhome%252fhelp-and-advice%252f
I have had no issues with this on my development server (running iis 7.5) but when deployed to our test server (iis7) the navigation fails to work.
Investigating this has shown that the above url gives a 500 error.
If i decode the url to
.../cms/Content/Navigation/LoadTree.ashx?target=preview&selected=/home/help-and-advice/
it works with no problems.
Unfortunately i cannot change the code that generates this as its a part of the n2cms source code and i am assuming it has been encoded for a good reason.
Does anyone know anything i can do either in my web.config to allow encoded parameters or something i can change on the iis server?
EDIT:
So this link seems to suggest that its doing this on purpose as a security mesure.
http://msdn.microsoft.com/en-us/library/ee656542.aspx
The suggested solution is to upgrade to .net 4.0 and add the following to the web.config
<configuration>
<uri>
<schemeSettings>
<add name="http" genericUriParserOptions="DontUnescapePathDotsAndSlashes"/>
</schemeSettings>
</uri>
</configuration>
Unfortunately this seems to have no effect.
Any Ideas why this doesnt work?
This could be the URLScan utility. URL Scan blocks URL's based on the rules in it's config file. It also has it's own log file, so you can tell for sure by looking at the URLScan log.
Do a google search for URLSCan default location.
It seems your url goes through 2 html encode.
Is there some url rewriting module active on your IIS7 server ?
OK, im getting somewhere with this.
When trying to find the error in the IIS logs and failing, then looking through many posts about failed tracing request and still not getting any errors in iis, i figured that the request was just not getting to IIS.
Looking back at the server error, there was a clue there too.
500 Internal Server Error. The request was rejected by the HTTP filter.
It is the firewall!!
We have disabled the HTTP Filter and now it works :)
I now need to investigate what this HTTP Filter was supposed to be protecting us against and are we secure now we have switched it off.

Not able to access the FLEX ,BLAZEDS,JAVA Application from other computer

I have developed a FLEX ,BLAZE DS,JAVA,Hibernate Application and able to deploy and run in my localhost on tomcat.
When i am trying to run the same URL with my IP Address from other computer in LAN. I am able to see the FLEX page but when i clicking on "Login" button,nothing is happening, means it is not further communicating to server and always looking for localhost.
I am pasting the some part of service-config and hibernate-cfg.xml contents for ref.
service-config.xml
<channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
<endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
</channel-definition>
hibernate.cfg.xml
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://{server.name}/testdb</property>
Please help me to resolve this issue.
Thanks in advance.
Aj
This looks like a security issue.
On the computer that doesn't work, make sure you add the application's domain or folder into the Flash Global Security list:
http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html
For example, if you're accessing from an IP 192.168.0.0, add http://192.168.0.0 into the list.
If this doesn't work, make sure you narrow down the problem by using Firebug on Firefox, or similar tool to see if there are any errors in the network calls (data may be getting an error message, etc).
If you find that your error is transferring, and the bug is in your application- get FlashTracer and the Flash Debug Player so that you can trace any Flex/Flash errors that occur. I'm naming some of the tools I'm using, but I'm sure there are other debugging tools out there that can help you do the same thing.
Good luck!
I agree with #Garrt, looks like a security issue. I know that you may have some problems when you try to access the server from a differente domain. In this link they explain some configurations that should be done:
http://www.javaworld.com/javaworld/jw-01-2009/jw-01-javaee-flex-1.html?page=5
I hope it helps!

Request Filtering/URL rewriting with IIS7 - not working

I cannot get the URL rewriting module to work on my local PC (vista x86)
i set up a new rule using the 'user friendly url' template.
a picture rather than 1000 words....
(the image contains 3 shots - creation, config and pattern test)
http://www.sk8loc8.com/rewriteIssue.jpg
so now that is setup if i request 'localhost/iisrewriteurl/content/5 i should see my content.aspx page.
nope...
Error Summary
HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
Detailed Error Information
Module IIS Web Core
Notification MapRequestHandler
Handler StaticFile
Error Code 0x80070002
Requested URL IISRewriteURL/content/5/
Physical Path C:\Users\Guy\Documents\Visual Studio 2008\Projects\IISRewriteURL\IISRewriteURL\content\5\
Logon Method Anonymous
Logon User Anonymous
When i go back into the rule itself and test the patterns that IIS made for me, they do not work..
I have tried adding a wildcard script map under the handler mappings section but this makes no difference.
Has anyone seen this type of behaviour before? Or am i missing something very simple?
If you test the pattern you dont need the Host
I always just create Blank Rules and not had a problem that way since not sure if it matters though. I cannot discover why that rewrite wouldnt work perhaps other rules are blocking it?
Alternatively you may have a look at Helicon Ape product that emulates Apache modules behavior on IIS7. It has simpler syntax and Helicon Ape Manager automatically checks the syntax of the rules you write.

Resources