wsman requests in apache server - mod-wsgi

I had configured mod_wsman module in apache server. got xml error response when entering ip address in browser. I have also configured mod_wsgi module for web.py python web framework for rendering web pages. So I had given valid urls in browser, it didn't displayed.
Is any body working on mod_wsman.

Apache and WSMAN services are run in a separate process state. Apache is working in 80 ports, while WSMAN service work in other ports, such as port 8889.
Module to write the most important is to write the the wsman a hook function wsman_handler (request_rec * r), its incoming parameter is a pointer point to the Apache message, the beginning of the function is to determine the type of request, if not is wsman request, the module returns DECLINED The code shown below,
if( strcmp(r->handler, "wsman-handler")) if (strcmp (r-> handler, "wsman-handler"))
return DECLINED; return DECLINED

Related

Apache can't reach site when I pass parameters to the page

I am working with TwoRavens which I deployed to Apache server on a docker container.
Now whenever I try to access the TwoRavens instance, I can do that by requesting this link: localhost:85/dataexplore/gui.html which works just fine and shows the page I requested.
However, when I try to pass some parameters to the page (which I should to perform some actions):
localhost:85/dataexplore/gui.html?dfId=19&key=2d5c9180-2b8a-4ae1-bcf0-7a1f7c60847b
Apache throws a message indicating that this site can't be reached.

Grails generating proper links when deployed behind proxy

Consider the following setup for a deployed Grails application.
the Grails application is deployed on a Tomcat server (tomcat7)
in front of Tomcat an Apache webserver is deployed
Apache does SSL offloading, and acts as a proxy for Tomcat
So far a quite standard setup, which I have used succesfully many times. My issue is now with the links generated by the Grails application, especially those for the redirects (the standard controller redirects, which occur all the time e.g. after succesfully posting a form).
One configuration is different from all the other applications so far: in this Grails application no serverURL is configured. The application is a multi-tenant application, where each tenant is given it's own subdomain. (So if the application in general is running under https://www.example.com, a tenant can use https://tenant.example.com.) Subdomains are set automagically, that is without any configuration at DNS or Apache level. Grails can do so perfectly, by leaving out the serverURL property in Config.groovy: it then resolves all url's by inspecting the client host.
However: when generating redirect-url's, Grails is not aware the website is running under https. All redirect url's start with http... I guess this is no surprise, because nowhere in the application it is configured we are using https: there is no serverURL config, and technically the application is running on the standard http port of Tomcat, because of the SSL offloading and proxying by Apache.
So, bottom line: what can I do to make Grails generate proper redirects?
I have tried to extend the DefaultLinkGenerator and override the makeServerURL() method. Like this:
class MyLinkGenerator extends DefaultLinkGenerator {
MyLinkGenerator(String serverBaseURL, String contextPath) {
super(serverBaseURL, contextPath)
}
MyLinkGenerator(String serverBaseURL) {
super(serverBaseURL)
}
def grailsApplication
/**
* #return serverURL adapted to deployed scheme
*/
String makeServerURL() {
// get configured protocol
def scheme = grailsApplication.config.grails.twt.baseProtocol ?: 'https://'
println "Application running under protocol $scheme"
// get url from super
String surl = super.makeServerURL()
println "> super.makeServerURL(): $surl"
if (surl) {
// if super url not matching scheme, change scheme
if (scheme=='https://' && surl?.startsWith('http://')) {
surl = scheme + surl?.substring(7)
println "> re-written: $surl"
}
}
return surl
}
}
(Maybe not the most beautiful code, but I hope it explains what I'd like to do. And I left out the bit about configuring this class in resources.groovy.)
When running this code strange things happen:
In the log you see the code being executed, and a changed url (http > https) being produced, but...
The redirect sent to the browser is the unchanged url (http)
And even worse: all the resources in the generated views are crippled: they now all start with // (so what should be a relative "/css/myapp.css" is now "//css/myapp.css")
Any help or insight would be appreciated!
Grails version is 2.1.1 by the way (running a bit behind on upgrades...).
It seems you're always talking https to the outside world, so your cleanest option is to solve the problem where it originates, at your Apache webserver. Add to httpd.conf Header edit Location ^http://(.*)$ https://$1, and you're done.
If you have limitations that force you to solve this in your application you could do the rewrite of the Location header field in a Grails after interceptor. Details of that solution are in this post.
Some years have past since this question was written, but problems remain the same or at least similar ;-)
Just in case anyone hits the same/similar issue (that Grails redirect-URLs are http instead of https) ... We had this issue with a Grails 3.3.9 application running on OpenShift. The application was running in HTTP mode (on Port 8080) and the OpenShift Loadbalancer was doing the SSL-Termination.
We solved it by putting
server:
use-forward-headers: true
into our application.yml. After that Grails works perfect and all the redirects created were correct with https://.
Hint: We have do not use grails.serverURL in our configuration

Apache custom dynamic error response

I've seen hundreds of pages explaining how to create custom error pages in Apache 2 server. My question is different. I have a web application running in Apache (it is a ISAPI DLL, but it could also be a CGI executable). My application can handle internal server errors and generate a detailed error message (for instance, include a full stack trace), included in the response together with error code 500. AFAIK, Apache just let me use redirection in order to display custom error messages: http://httpd.apache.org/docs/2.2/custom-error.html
HTTP spec (RFC 2616 - section 10), not only allows but also recommend that detailed error message should be included in the BODY section of the response in case of error code > 500.
Link: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5
Seems that Apache won't let my custom error message go to the browser, and always replace it with its own internal error message and I believe that it is not the correct behavior, based on RFC 2616.
So my question is: Is there any setting in Apache server that will let my custom message go to the browser? Or, is there anything that can be done in my application that will instruct Apache to send my custom error message (something like some specific header field in the response)?
More on the subject:
When my ISAPI application returns error code 500, with other error information in the response body, Apache replaces it with its standard "500 Internal Server Error" message/HTML content, and inside Error.log file I can see the "useless" "Premature end of script headers" message. I'm deeply sure that my headers are fine, including the Content-Type field.
If I replace the 500 error code with any other server error code (e.g. 501) it works flawlessly and my response goes to the browser as is. The same header is sent to the Apache server, only the error code is different (501, instead of 500). With this test result in mind, one of these two must be true:
1- Apache requires some specific header field when status code is 500
2- Apache won't let custom error messages with status code 500 go to the browser.
I don't see any other alternative.
I think you're conflating two questions. You can generate a 500 response with a CGI script and include your custom body. Or you can override any 500 with any resource you want.
If you're failing to do the former, it's likely because of some subtle thing in the ISAPI interface between Apache and your module. Desk-checking the code says you should be able either set the pseudo
Status: 500
Header, or basically return any ISAPI error and end up with a 500 and your custom body.
Apache has two notions of a status code -- the one in the status line (r->status) and an error code returned separately from the module that handles the request (return HTTP_INTERNAL_SERVER_ERROR, return r->status).
When the former is used as the latter is when the custom error messages get lost. All of that happens in./modules/arch/win32/mod_isapi.c in Apache. Whatever is going on, it is ISAPI unique.

Response 400 (bad request) when invoking WCF service with other user than Administrator

I have a simple WCF service (hosted in Server01) which I've been using with no problems. After installing in this particular server (lets call it ClientServer01), I started to get the response 400.
So we have the following two cenarios.
Call WCF service from ClientServer01 from myApp.exe running as Administrator - Works
Call WCF service from ClientServer01 from myApp.exe running as CustomUser - Crashes
Aditional data:
ClientServer01 uses a proxy that is inside it's network to communicate
I'm able to ping Server01 from ClientServer01 using cmd running as Administrator and CustomUser both
Already tried setting expect100Continue="false" as described here
I've made MyApp.exe to isolate the problem and for debugging purposes, the real application is an IIS website in ClientServer01
The service is not a big deal. Pretty basic unsecured WCF service with BasicHttpBinding
Before asking, I tried to analyse the request with fiddler, it worked, because the component that was really making the request was fiddler. Today I tried it again, but running fiddler as mycustom user here is the output:
ERROR
The requested URL could not be retrieved
The following error was encountered while trying to retrieve the URL:
/MyServiceAppName/MyServiceName.svc
Invalid URL
Some aspect of the requested URL is incorrect.
Some possible problems are:
• Missing or incorrect access protocol (should be “http://” or similar)
• Missing hostname
• Illegal double-escape in the URL-Path
• Illegal character in hostname; underscores are not allowed.
Your cache administrator is webmaster.
Generated Mon, 27 May 2013 13:58:09 GMT by fw3.companyhostname.com.br
(squid/3.1.11)
Am I missing some server, proxy or WCF configuration that would allow CustomUser to make an http request thought port 80 to a basic WebService?
Thanks
CustomUser's proxy was not configured. So UseDefaultWebProxy would refer to an invalid proxy.
There are some solutions to this kind of problem
Set target user proxy settings (the most appropriate IMO)
Set binding ProxyAddress property
Set default app proxy in .config file tag configuration/system.net/defaultProxy/proxy <proxy proxyaddress="http://ip:port" />

How does one enable or verify the REST interface of ActiveMQ?

I setup ActiveMQ 5.8.0 on a Windows 2003 virtual server for development purposes. I understand that there is suppose to be a REST interface for reading from and writing to queues and such. But, I can't seem to track down how to do it exactly. Port 8161 can be used to access the admin console, but every URL I try from Firefox Poster returns a 404. I tried URLs like these:
http://localhost:8161/queues <-- 404
http://localhost:61616/queues <-- some default message
http://localhost:61616/queue/inbox <-- same default message
http://localhost:8161/queue/inbox <-- 404
The documentation mentions mapping a URI to the servlet, but I'm not sure how or if I need to do this. The /demo feature is disabled by default, which is fine by me. How do I enable REST for my queues? Thanks!
As /demo is disabled, it been moved to /api
http://localhost:8161/api/message/
this is the path for all REST operations