CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Import (Moderator: Yashodha Chaku) »
  • Import error: 403/400; "no permission to access /civicrm/import/contact"
Pages: [1]

Author Topic: Import error: 403/400; "no permission to access /civicrm/import/contact"  (Read 3501 times)

tog22

  • I’m new here
  • *
  • Posts: 20
  • Karma: 0
  • CiviCRM version: CiviCRM 4
  • CMS version: Drupal 7
  • MySQL version: Varies
  • PHP version: Varies
Import error: 403/400; "no permission to access /civicrm/import/contact"
November 11, 2011, 03:46:35 pm
When I try to import contacts from a csv file via mydomain.com/civicrm/civicrm/import/contact (in which the first civicrm is my drupal 7 dir, so the URL within civicrm is  /civicrm/import/contact, I get:

"You don't have permission to access
/civicrm/civicrm/import/contact
on this server.

Additionally, a 404 Not Found error was encountered while trying
to
use an ErrorDocument to handle the request."

The browser title is 403 Forbidden. But I'm using the Drupal admin user with full CiviCRM permissions, and CiviCRM works fine (if slow) otherwise, and this doesn't appear to be a real file I can change permissions on.

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Import error: 403/400; "no permission to access /civicrm/import/contact"
November 12, 2011, 10:21:25 am
Sounds like your server is blocking this somehow. Try to visit mydomain.com/civicrm/index.php?q=civicrm/import/contact and if that works, then Drupal and CiviCRM are fine and something in your server config is the issue.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

tog22

  • I’m new here
  • *
  • Posts: 20
  • Karma: 0
  • CiviCRM version: CiviCRM 4
  • CMS version: Drupal 7
  • MySQL version: Varies
  • PHP version: Varies
Re: Import error: 403/400; "no permission to access /civicrm/import/contact"
November 13, 2011, 09:19:21 am
Thanks that works. Any idea what could be causing it, as other 'clean URL's work in Drupal (without '?q=')?

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Import error: 403/400; "no permission to access /civicrm/import/contact"
November 13, 2011, 11:07:22 am
No, I don't. I do recall we had a thread here with a similar issue and they found some sort of server setting that was blocking a certain URL. But I don't remember the details unfortunately.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

mcarson

  • I post occasionally
  • **
  • Posts: 110
  • Karma: 5
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7.x
  • MySQL version: 5.5
  • PHP version: 5.4.22
Re: Import error: 403/400; "no permission to access /civicrm/import/contact"
November 14, 2011, 01:28:30 am
Check your Drupal homepage setting - maybe change it to 'node' temporarily. Also check your Drupal and CiviCRM configuration settings looking at the paths...
“Anyone who has never made a mistake has never tried anything new.” - Albert Einstein
"If you are travelling at the speed of light and you turn on your headlights, would they work?" - Unknown

tog22

  • I’m new here
  • *
  • Posts: 20
  • Karma: 0
  • CiviCRM version: CiviCRM 4
  • CMS version: Drupal 7
  • MySQL version: Varies
  • PHP version: Varies
Re: Import error: 403/400; "no permission to access /civicrm/import/contact"
November 14, 2011, 06:38:39 am
Quote from: mcarson on November 14, 2011, 01:28:30 am
Check your Drupal homepage setting - maybe change it to 'node' temporarily. Also check your Drupal and CiviCRM configuration settings looking at the paths...

Can you expand on that? I'm not sure what settings you're suggesting I check - I can paste any config info here if you point me to it. But as I said it's basically a fresh install of Drupal and CiviCRM, with the front page still set to 'node' as in the default.

Upperholme

  • Administrator
  • Ask me questions
  • *****
  • Posts: 568
  • Karma: 8
    • MC3
  • CiviCRM version: 4.x
  • CMS version: Drupal 6.x/7.x, Wordpress, Joomla
Re: Import error: 403/400; "no permission to access /civicrm/import/contact"
November 15, 2011, 05:49:31 am
I had a similar issue the other day. On checking the server logs it appeared that the hosting provider was using modSecurity to attempt to control malicious use of the server, with the result that I was stopped from doing stuff. I raised it with them and they've fixed it.
Graham Mitchell
http://mc3.coop

mcarson

  • I post occasionally
  • **
  • Posts: 110
  • Karma: 5
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7.x
  • MySQL version: 5.5
  • PHP version: 5.4.22
Re: Import error: 403/400; "no permission to access /civicrm/import/contact"
November 16, 2011, 01:50:41 pm
Probably not relevant now...

I am just wondering if the error you are having is somehow related to your drupal install directory being named 'civicrm'. This means that every link would appear as 'domain.tld/civicrm/civicrm/...'

Please could you check the $base_url setting in your settings.php file? (civicrm/sites/default/settings.php) Just in case this hasn't been set properly.

Also, as with my sites with Drupal in a subdirectory, a setting in .htaccess  under the following text:
Code: [Select]
# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at http://example.com/drupal uncomment and
# modify the following line:
But, I cannot confirm if this applies to Drupal 7 ( I use Drupal 6)

It may also be related to the apache server config. If your server runs php under a different user (suphp, fcgi) then php uploads to your site (import?) will have 'apache' or 'www-data' ownership. Drupal will not have permissions to read these (by default). If you run your own server, this is relatively easy to fix. Otherwise, raise a support request with your host.
“Anyone who has never made a mistake has never tried anything new.” - Albert Einstein
"If you are travelling at the speed of light and you turn on your headlights, would they work?" - Unknown

tog22

  • I’m new here
  • *
  • Posts: 20
  • Karma: 0
  • CiviCRM version: CiviCRM 4
  • CMS version: Drupal 7
  • MySQL version: Varies
  • PHP version: Varies
Re: Import error: 403/400; "no permission to access /civicrm/import/contact"
November 17, 2011, 09:48:12 am
Quote from: mcarson on November 16, 2011, 01:50:41 pm
Probably not relevant now...

I am just wondering if the error you are having is somehow related to your drupal install directory being named 'civicrm'. This means that every link would appear as 'domain.tld/civicrm/civicrm/...'

Correct, I assumed that wasn't a problem

Quote
Please could you check the $base_url setting in your settings.php file? (civicrm/sites/default/settings.php) Just in case this hasn't been set properly.

All I see is a commented out line :

 # $base_url = 'http://www.example.com';  // NO trailing slash!

Should I change this?

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Import error: 403/400; "no permission to access /civicrm/import/contact"
November 17, 2011, 10:28:58 am
Generally speaking, you don't need to change that line. Unless something isn't working correctly. I suppose you could try...
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

petbos157

  • I’m new here
  • *
  • Posts: 26
  • Karma: 2
  • CiviCRM version: 4.4.3
  • CMS version: Drupal 7
  • MySQL version: 5.1.71
  • PHP version: 5.3.3
Re: Import error: 403/400; "no permission to access /civicrm/import/contact"
November 29, 2011, 04:37:58 am
Maybe you can check if mod_security is given this error.
I've such a problem when i want to add a new contact. I've got this message :

You don't have permission to access /nl/civicrm/contact/add&reset=1&ct=Individual on this server.

When i disable mod_security, then this page will work.
It hold the page because it's thinking that the URL contains a sql injection attack. (modsecurity_crs_41_sql_injection_attacks.conf)
I don't know how to solve it, i'm still searching.

petbos157

  • I’m new here
  • *
  • Posts: 26
  • Karma: 2
  • CiviCRM version: 4.4.3
  • CMS version: Drupal 7
  • MySQL version: 5.1.71
  • PHP version: 5.3.3
Re: Import error: 403/400; "no permission to access /civicrm/import/contact"
November 29, 2011, 05:07:22 am
I've solved it by comment out line nr 573, 539 and 533. (probably not the wright solution, but it helped me)
See your modsec_audit.log file for more details

petbos157

  • I’m new here
  • *
  • Posts: 26
  • Karma: 2
  • CiviCRM version: 4.4.3
  • CMS version: Drupal 7
  • MySQL version: 5.1.71
  • PHP version: 5.3.3
Re: Import error: 403/400; "no permission to access /civicrm/import/contact"
November 29, 2011, 06:23:44 am
I've came up with a better solution,so you don't need to change in the core-files.
Create a file 'modsecurity_customrules.conf' in the directory '/etc/httpd/modsecurity.d' (for redhat)
and add this to it :

# Exceptions for yourdomain.org
<LocationMatch> '^.*civicrm.*Individual'>
SecRuleRemoveByID 981244
SecRuleRemoveByID 981248
SecRuleRemoveByID 981243
</LocationMatch>


Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Import (Moderator: Yashodha Chaku) »
  • Import error: 403/400; "no permission to access /civicrm/import/contact"

This forum was archived on 2017-11-26.