I currently have an ejabberd 17.03 server running on a windows machine.
I am trying to enable mod_http_fileserver on ejabberd. I used the following configuration in the listen section :
port: 5280
module: ejabberd_http
request_handlers:
"/websocket": ejabberd_http_ws
"/api": mod_http_api
"/pub/archive": mod_http_fileserver
web_admin: true
http_bind: true
## register: true
captcha: false
and in the modules :
mod_http_fileserver:
docroot: "C:\\Tech\\ejabberd-17.03\\www"
accesslog: "C:\\Tech\\ejabberd-17.03\\logs\\access.log"
directory_indices:
- "index.html"
- "main.htm"
custom_headers:
"X-Powered-By": "Erlang/OTP"
"X-Fry": "It's a widely-believed fact!"
content_types:
".ogg": "audio/ogg"
".png": "image/png"
".jpg": undefined
default_content_type: "text/html"
However, when I try to access http://localhost:5280/pub/archive, I get a 404 not found response.
Can someone help me out please ?
Thanks !
Related
What's the right way to reuse config.yaml for routing?
Situation:
I have a typo3 installation with different websites. The routing-config with more than 200 lines is saved in:
\typo3conf\sites\website1\config.yaml
What the right way to use this config.yaml with all other websites and only reconfig the differences in:
\typo3conf\sites\website2-100\config.yaml
With typoscript this where easy. Is there a way to use this:
1. <INCLUDE_TYPOSCRIPT: source="FILE:\typo3conf\sites\website1\config.yaml">
2. Overide differences like "rootPageID: 2" or delete configs with ">"
To elaborate Jonas' hint, here a more concrete example:
Site configuration for the single site which is similar to all other and thus should be as short as possible, stored in sites/mysite/config.yaml
rootPageId: 14523
base: 'https://www.mysite.mytld'
imports:
- { resource: "EXT:mysitepackage/Configuration/Sites/defaultSiteConf.yaml" }
Content of EXT:mysitepackage/Configuration/Sites/defaultSiteConf.yaml, the default config shared for basically all sites (although exceptions are possible).
imports:
- { resource: "EXT:mysitepackage/Configuration/Sites/errorHandling.yaml" }
- { resource: "EXT:mysitepackage/Configuration/Sites/language.yaml" }
- { resource: "EXT:mysitepackage/Configuration/Sites/route.pages.yaml" }
- { resource: "EXT:mysitepackage/Configuration/Sites/route.tt_news.yaml" }
Content of EXT:mysitepackage/Configuration/Sites/language.yaml, as an example that the default config can be split into multiple files to track changes more easily
languages:
- title: Deutsch
enabled: true
base: /
typo3Language: de
locale: de_DE.UTF-8
iso-639-1: de
navigationTitle: Deutsch
hreflang: de-DE
direction: ltr
flag: de
languageId: '0'
- title: English
enabled: true
base: /en/
typo3Language: default
locale: en_GB.UTF-8
iso-639-1: en
navigationTitle: English
hreflang: en-GB
direction: ltr
fallbackType: fallback
fallbacks: '0'
flag: gb
languageId: '1'
If you use TYPO3v9, you can use imports:.
Documentation:
https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/Yaml/Index.html
From TYPOv10 on they can be relative, too:
Changelog:
https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/10.1/Feature-88742-ImportYamlFilesRelativeToTheCurrentYamlFile.html
Im using Ejabberd 17.1.1. I need to configure my ejabberd.yml file for websocket communication. Im using strophe.js
I already had the configuration for ejabberd.yml ie,
port: 5280
ip: "::"
module: ejabberd_http
request_handlers:
"/ws": ejabberd_http_ws
"/bosh": mod_bosh
"/api": mod_http_api
## "/pub/archive": mod_http_fileserver
web_admin: true
## register: true
captcha: false
http_bind: true
tls: true
Also tried to get connection from my javascript code,
var conn = new Strophe.Connection('ws://localhost:5280/ws/', {protocol: "ws"});
conn.connect($scope.jid, $scope.password, function(status, condition) {
if (status === Strophe.Status.CONNECTED) {
...
when getting the
status
its value is 1 not 5. what is the reason? I was able to connect the same one with
http://localhost:5280/bosh/ successfully.
Can any one give the correct configuration of ejbberd.yml file and sample code snippet for connecting through websocket using strophe.js. Thanks .
I have an ejabberd server up and running.
I can test it via web clients and it works fine using BOSH connections.
I would like to connect to it via web sockets now, and I am not sure what I am missing for it to work, I just know it doesn't.
Here is an extract from my ejabberd.yml
hosts:
- "localhost"
- "somedomain.com"
- "im.somedomain.com"
listen :
port: 5280
ip: "::"
module: ejabberd_http
request_handlers:
"/websocket": ejabberd_http_ws
"/pub/archive": mod_http_fileserver
web_admin: true
http_bind: true
## register: true
## captcha: true
tls: true
certfile: "/etc/ejabberd/ejabberd.pem"
Now I tried to open a web socket via javascript as follows :
var ws = new WebSocket("ws://somedomain:5280/websocket/");
I get ERR_CONNECTION_TIMED_OUT in return. I have nothing within ejabberd's logs when I try to open a weksocket. I do have logs of the BOSH connections.
I am not sure if I am testing appropriately, nor if my server is setup correctly.
Any suggestion is most welcome.
Connection timeout error will throw by the server when the client does not send pong response to the server make sure you are sending the pong response.If you are using Strophe.js kindly check Handlers http://strophe.im/strophejs/doc/1.2.14/files/strophe-js.html#Strophe.Connection.addHandler
connection = new WebSocket("ws://somedomain:5280/websocket/");
//Adding ping handler using strophe connection
connection.addHandler(pingHandler, "urn:xmpp:ping", "iq", "get");
//Ping Handler Call back function
function pingHandler(ping) {
var pingId = ping.getAttribute("id");
var from = ping.getAttribute("from");
var to = ping.getAttribute("to");
var pong = strophe.$iq({
type: "result",
"to": from,
id: pingId,
"from": to
});
connection.send(pong);
return true;
}
Also, consider you are adding this configuration to your ejabberd.yml
websocket_ping_interval: 50
websocket_timeout: 60
I'm now writing a vue project and I want to send some api requests to the remote server.
So I add this in my webpack.dev.conf.js:
devServer: {
historyApiFallback: true,
noInfo: true,
hot:true,
open:true,
proxy: {
'/api': {
target: 'http://47.93.247.233',
secure: false,
changeOrigin: true,
pathRewrite: {'^/api' : ''}
}
}
},
But I still get 404 in my browser.
And I'm sure the server is ok:
I think maybe the webpack devServer didn't forward my http request to the remote server. Is there anything wrong in my code? Or, can I try some other methods?
Thanks in advance!
Did you try to use
proxyTable: {...},
instead of
proxy{}
I'm running with webpack version 3.10.0 with npm v 5.6.0 and this works fine!
May be, you will try "logLevel: 'debug' too, to see some hints in your terminal window.
Can someone guide me how to configure generator-webapp to use HTTPS instead of HTTP.
Tried https option and specified key files but somehow I made something wrong.
Thanks.
Figured it out by myself. All that needs to be done was to add https. The rest will be handled by browserSync. It also assigns a self-signed certificate.
browserSync: {
options: {
notify: false,
background: true,
watchOptions: {
ignored: ''
},
https: {
key: '',
cert: ''
}
},