Your software
My Mautic version is: 4.2.1
My PHP version is: 7.4
My Database type and version is:
Nginx
Your problem
My problem is:
i try generate form from
# Mautic - Grav Plugin
This is [Grav CMS](http://getgrav.org) plugin that helps you configure [Mautic](https://mautic.org) tracking and converts markdown "links" and shortcodes into HTML that embeds Mautic content on your Grav page.
# Installation
Installing the Mautic - Grav plugin can be done in one of two ways.
## GPM Installation (Preferred)
The simplest way to install this plugin is via the [Grav Package Manager (GPM)](http://learn.getgrav.org/advanced/grav-gpm) through your system's Terminal (also called the command line). From the root of your Grav install type:
bin/gpm install mautic
This will install the Mautic - Grav plugin into your `/user/plugins` directory within Grav. Its files can be found under `/your/site/grav/user/plugins/mautic`.
## Manual Installation
To install this plugin, just [download](https://github.com/mautic/mautic-grav/archive/master.zip) the zip version of this repository and unzip it under `/your/site/grav/user/plugins`. Then, rename the folder to `mautic`.
This file has been truncated. show original
but /form/generate.js?id=1 not show
These errors are showing in the log: log is clean
Steps I have tried to fix the problem:
rebuild form cache
clear cach
joeyk
April 27, 2022, 1:52pm
2
zaharovrd:
# Mautic - Grav Plugin
Maybe @escopecz knows the answer.
the problem is NOT in the plagin
problem in generate.js that’s he’s not generated forms
Example, you can test:
https://m.everest-dom.com/form/generate.js?id=1
you can paste this line to your site (I turned off CORS temporarily) and nothing will happen - the form will not be generated
mikew
April 27, 2022, 2:08pm
4
have you checked your web server configurations ? I had some issues with nginx in the past
i have default nginx config…
i see this bug
opened 02:40PM - 05 May 20 UTC
closed 12:41PM - 16 May 20 UTC
[//]: # ( Invisible comment:
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII… I
Before you create the issue:
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
Search for similar report among other reported issues.
Learn how to troubleshoot at https://www.mautic.org/docs/en/tips/troubleshooting.html
Use drag&drop to attach images or other files )
## Bug Description
I have 2 problems that I think are related somehow. Tracking pixels and JS code load fine in the browser, but their http code is 404, same for the forms, but for these, they don’t even work when I try to embed them in a website.
curl -I https://mymauticinstall.com/mtc.js
HTTP/2 404
server: nginx
content-type: application/javascript; charset=utf-8
vary: Accept-Encoding
set-cookie: 7bb85555927bdb8d66d3d0ee6d04ad51=ap53f7bm8auttj8o1hqqlso3aa; path=/; secure; HttpOnly
cache-control: no-cache
date: Mon, 04 May 2020 22:41:30 GMT
This file when loaded in a browser shows the correct content, but it also shows a 404 error, same for the JS that loads the forms. But in the case of the forms as I said, it prevents them from working completely, so nothing gets rendered.
| Q | A
| --- | ---
| Mautic version | 2.16.2
| PHP version | 7.3.17-1+ubuntu18.04.1+deb.sury.org+1
| Browser | 81.0.4044.129 (Official Build) (64-bit)
### Steps to reproduce
1. Install Mautic on Laravel Forge (Nginx)
2. Make use of the tracking code and embedded forms
### Log errors
Nginx:
2020/05/04 17:39:49 [debug] 28961#28961: *1 http filename: “/home/forge/mymauticinstall.com/public/mtc.js”
2020/05/04 17:39:49 [debug] 28961#28961: *1 add cleanup: 00005627D28D57B8
2020/05/04 17:39:49 [error] 28961#28961: *1 open() “/home/forge/mymauticinstall.com/public/mtc.js” failed (2: No such file or directory), client: 179.6.209.113, server: mymauticinstall.com, request: “HEAD /mtc.js HTTP/2.0”, host: “mymauticinstall.com”
2020/05/04 17:39:49 [debug] 28961#28961: *1 http finalize request: 404, “/mtc.js?” a:1, c:1
2020/05/04 17:39:49 [debug] 28961#28961: *1 http special response: 404, “/mtc.js?”
2020/05/04 17:39:49 [debug] 28961#28961: *1 internal redirect: “/index.php?”
# Nginx config:
```
add_header 'Access-Control-Allow-Origin' "*";
# redirect index.php to root
rewrite ^/index.php/(.*) /$1 permanent;
# Allow the filemanager to work
location ~ ^/app/bundles/CoreBundle/Assets/js/libraries/ckeditor/filemanager/connectors/php/filemanager.php$ {
allow all;
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
include fastcgi_params;
}
# Deny everything else in /app folder except Assets folder in bundles
location ~ /app/bundles/.*/Assets/ {
allow all;
access_log off;
}
location ~ /app/ { deny all; }
# Deny everything else in /addons or /plugins folder except Assets folder in bundles
location ~ ^/(addons|plugins)/.*/Assets/ {
allow all;
access_log off;
}
location ~ ^/(addons|plugins)/ { deny all; }
# Deny all php files in themes folder
location ~* ^/themes/(.*)\.php {
deny all;
}
# Deny yml, twig, markdown, init file access
location ~* /(.*)\.(?:markdown|md|twig|yaml|yml|ht|htaccess|ini)$ {
deny all;
access_log off;
log_not_found off;
}
# Deny all attempts to access hidden files/folders such as .htaccess, .htpasswd, .DS_Store (Mac), etc...
# Except .well-known to allow for certbot to issue and renew certificates
location ~ /\.(?!well-known).* {
deny all;
access_log off;
log_not_found off;
}
# Deny all grunt, composer files
location ~* (Gruntfile|package|composer)\.(js|json)$ {
deny all;
access_log off;
log_not_found off;
}
# Deny access to any files with a .php extension in the uploads directory
location ~* /(?:uploads|files)/.*\.php$ {
deny all;
}
location ~ ^/mtc.js {
default_type "application/javascript";
try_files $uri $uri/ /index.php$is_args$args;
}
location ~* ^/media/js/$ {
add_header 'Cache-Control' public;
expires 7d;
}
location ~ \.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$ {
allow all;
try_files $uri $uri/ /index.php$is_args$args;
}
# Set cache expiry time
location ~* \.(jpg|jpeg|png|ico|css)$ {
expires 365d;
}
location ~* \.(pdf)$ {
expires 30d;
}
# Add X-Robots-Tag header to login page to prevent bots from indexing or following
add_header X-Robots-Tag "noindex, nofollow"
```
Any help is appreciated, thanks.
PS. Just want to clarify that CORS is disabled.
[//]: # ( Invisible comment:
Please check for related errors in the latest log file in [mautic root]/app/log/ and/or the web server's logs and post them here. Be sure to remove sensitive information if applicable. )
but i don’t have 404 error
mikew
April 27, 2022, 2:11pm
6
in nginx make sure you have enabled *.js
location ~ /(mtc.js|1.js|.*\.js|mtracking.gif|.*\.gif|mtc) {
Many default Mautic nginx configurations are
location ~ /(mtc.js|1.js|mtracking.gif|.*\.gif|mtc) {
mikew
April 27, 2022, 2:12pm
7
sorry last thing - are you getting any console errors ?
I don’t have such lines at all
What should be in brackets below?
mikew
April 28, 2022, 10:55am
10
these are your log files, if you are on chrome you can right click and “inspect” and then choose “console” to see if there are any other errors there.
To get a full explanation of nginx and setting up Mautic check out here . He has a full nginx conf file there that you can use, however you need to make the changes to it that I recommended above.
it was the first thing I looked at. It’s clean…
interesting that focus working perfectly
mikew
May 1, 2022, 9:58am
12
voodoo magic. Glad it is all working now
No, not working (
Forms not showing
mikew
May 2, 2022, 6:41am
14
maybe try and change your base url to Mautic and see if that works
Does it work for you? Can I see somewhere how it is implemented?
I changed the nginx config…
F12 in Firefox - no errors
inserting a form through js code does not work.
You can try it:
<script type="text/javascript" src="//m.mautibox.ru/form/generate.js?id=3"></script>
I tried it right away, I thought it might not work out the way. Did not help.
But the interesting thing is that the focus works great
it’s a gravcms
if focus work fine, but forms not working - i think that problem in generate.js
Ha-ha-ha
Earned!
the problem was in
i removed js from hear and all Earned
1 Like
robm
September 6, 2022, 9:43am
19
@mikew - adding the /index.php/ to the js for a form did the trick.
The bigger question though is how do I set up my Mautic so I don’t need to manually add in /index.php/ to each js script to get a mautic form to render?
mikew
September 6, 2022, 10:10am
20
Hey Rob,
It is an nginx conf file misconfiguration, I fixed this on your server - so please check and let me know if working now.
mikew:
in nginx make sure you have enabled *.js
location ~ /(mtc.js|1.js|.*\.js|mtracking.gif|.*\.gif|mtc) {
Many default Mautic nginx configurations are
location ~ /(mtc.js|1.js|mtracking.gif|.*\.gif|mtc) {
1 Like