Debug /http-bind/ issue Openfire - xmpp

Im using openfire for the xmpp to my website. I have done a server move and relocated the site on the same server as openfire as they were both on different servers before.
Since the move im getting error 500 on the /http-bind/ request on my website.
How can i debug this or what to i need to consider that may be causing the error 500 on /http-bind/
Error log
[warn] proxy: No protocol handler was valid for the URL /http-bind/. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.

Short answer: You need to load the 'proxy_http' module in Apache.
There are some instructions I wrote in the Prosody documentation on setting up BOSH with Apache, but they should apply equally to any BOSH/XMPP server. In particular I'm not sure whether Openfire is fussy about /http-bind vs. /http-bind/. Therefore if the below instructions do not work, try adding the / to the end of the URL.
Summary
Run: sudo a2enmod rewrite proxy proxy_http
Add the following lines to your Apache config:
<Location /http-bind>
Order allow,deny
Allow from all
</Location>
RewriteEngine On
RewriteRule ^/http-bind$ http://example.com:5280/http-bind [P,L]

I would like to add that with a properly configured server you can just put this in your .htaccess in the root of your web folder:
<IfModule mod_rewrite.c>
RewriteEngine On
# Rule1
RewriteCond %{REQUEST_URI} ^/chat1/http-bind
RewriteRule ^.*$ http://chatsrv1.joynmenow.com:7070/http-bind/ [P,L]
# Rule 2
RewriteCond %{REQUEST_URI} ^/chat2/http-bind
RewriteRule ^.*$ http://chatsrv2.joynmenow.com:7070/http-bind/ [P,L]
</IfModule>
I'm not exactly sure what configs are required to allow this in a .htaccess however my godaddy VPS allowed me to do this in it's default configuration.

Related

apache rewrite is doing redirect

In apache2 rewrite is doing redirect when i am writing following rewrite rule
RewriteRule ^id/(.*)$ http://pickyourjersey.com/index.php?id=$1 [NC,L]
and if i am removing NC then it shows error
Bad Request
Your browser sent a request that this server could not understand.
Apache/2.4.7 (Ubuntu) Server at pickyourjersey.com Port 80
If i am using relative path it works fine
replace with
RewriteEngine on
RewriteRule "^id/(.*)" "http://pickyourjersey.com/index.php?id=$1" [NC,L]

How to remove /web/ from Yii2 Advanced Template

I'm implementing a RESTful service using Yii2 advanced template following this guide. However, I'm ended up getting the following structure for the REST service:
http://localhost/MyProject/api/web/v1/user/1 whereas it should be
http://localhost/MyProject/api/v1/user/1.
How can I remove the /web/ from the URL path?
If you use apache in .htaccess
<IfModule mod_rewrite.c>
#Send all /api requests to api/web folder
RewriteRule ^api/(.*)$ api/web/$1
</IfModule>
You add below code in web.php file...
'components' => [
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
],
],
And Then add one file .htaccess file in web folder..
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
I actually like to use Kartik's Practical App or Practical-A App. They are based on the yii2-advanced template, but with some changes, like getting rid of the /web directory
If you are going to host it on your own server, just create a virtual host pointing to the api/web and you will have it sorted.
Here is a sample
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName api.websiteurl.com
DocumentRoot /var/www/html/app/api/web
</VirtualHost>
With that, I can access my api from api.websiteurl.com
If you want to api to be accessed from websiteurl.com, then just set the document root of your server to point to api/web

Redirection from www.example.com to www.example.com/index.jsp

I have setup apache2 and tomcat7 on ubuntu 14.04.
my domain name is www.example.com , which I want to redirect to the www.example.com/index.jsp on to the tomcat as this is the login page. How can this be done? The set up works fine for a request made to www.example.com/index.jsp. The apache virtualHost setting is
ProxyPass / ajp://localhost:8009/
ProxyPassReverse / ajp://localhost:8009/
the redirection in my understanding should happen on the apache. As the apache is acting just as a proxy and not serving any requests by itself can we use the directive ? Where and how to make the change. Any pointers appreciated
I tried rewriting the url in the virtualHost but it doesn't seem to be working
ServerName www.example.com <br>
RewriteEngine On <br>
RewriteRule ^http://www\.example\.com$ https://www.example.com/index.jsp [R]
You can use the following rewrite rule
RewriteEngine On
RewriteRule ^/$ /index.jsp [R]
It basically will search that if, the uri path starts and ends with a / it will redirect it to /index.jsp , this should do the trick.

APACHE2: avoid https:// REDIRECT to open phpmyadmin

I have a site https://example.net
to ensure that all users go to the https:// I set up a redirect with APACHE (on the default.conf) as followed:
<VirtualHost *:80>
ServerName example.net
Redirect permanent / https://emalsys.net
# DocumentRoot /var/www/example.net/
<VirtualHost *:80>
My issue is when I try to access my phpmyadmin example.net/phpmyadmin I redirect to https://example.net/phpmyadmin and the page cannot be displayed.
(It is obviously working if I remove the Redirect).
How can I get avoid the redirect only for my phpmyadmin?
Any idea?
This is what I use in my servers to force HTTPS
RewriteCond %{HTTPS} !=on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
For other examples see Apache's wiki https://wiki.apache.org/httpd/RewriteHTTPToHTTPS
You can enter a REWRITECOND before a rewriterule:
REWRITECOND %{REQUEST_URI} !^http://www.example.com/phpMyAdmin
REWRITERULE / https://emalsys.net
A way around:
I do not know why but if I type as url example.net/phpmyadmin I will be redirected to https://example.netphpmyadmin/ but if I write https://example.net/phpmyadmin/ (with the /)I go to php my admin.
No idea why but I hope it will be of help to others.
to force https:// on pyp myadmin I added: $cfg['ForceSSL'] = true; at the end of phpMyAdmin’s config.inc.php file (see http://thebarton.org/forcing-ssl-with-phpmyadmin/).

Redirect entire request to new domain, without post-pending ANY content after the .com of the original request

I have google'd for at least 3 hours and tried all the examples on stack overflow and other forums.
Does anyone know how to use .htaccess (either redirect or rewrite) to be able to redirect all traffic from one domain to another without passing anything after the .com?
I have an old domain:
http://www.olddomain.com
I want to redirect ALL requests to that domain to a specific URL
http://www.newdomain.com/new/directory/
I have tried quite a few types of redirects and rewrite rules in .htaccess, but if I make a request like:
http://www.olddomain.com/some/directory/
the redirect always comes to the new domain like:
http://www.newdomain.com/new/directory/some/directory/
The redirect is post pending the URI onto the redirect.
I have tried adding ? at the end of the new URL and that does not help.
Here are some of my redirects. (Domain names changed to protect the innocent)
RewriteEngine on
#RewriteRule ^ http://www.newdomain.com/new/directory/ [R=301,L]
#RewriteRule ^ http://www.newdomain.com/new/directory/? [R=301,L]
#RewriteRule /?$ http://www.newdomain.com/new/directory/? [R=301,L]
RewriteRule ^([^/\.]+)/?$ http://www.newdomain.com/new/directory/? [R=301,L]
I tried the Redirect command as well...
Redirect 301 / http://www.newdomain.com/new/directory/?
None of these seems to remove the /some/directory/ and just keep redirecting to
http://www.newdomain.com/new/directory/some/directory/
Any thoughts would be very much appreciated.
Try just:
RedirectMatch 301 ^ http://www.newdomain.com/new/directory/?
But if you would rather use mod_rewrite, it looks like you were pretty close with your rules, it just needs to have the regular expression match anything:
RewriteRule ^ http://www.newdomain.com/new/directory/? [R=301,L]
There's a caveat that if both of these domains are actually hosted on the same server, the same document root, and you're going to be putting this in an htaccess file, then you'll need to add an additional check above the RewriteRule for the host:
RewriteCond %{HTTP_HOST} olddomain.com$ [NC]